[ToolTips] probleme de binding
bonjour
un petit problème étonnant que j'ai rencontré
quand je fais sur une fenêtre
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<StackPanel Height="136"
Margin="256,0,168,44"
VerticalAlignment="Bottom">
<TextBlock Text="Information functions"
FontWeight="Bold" />
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="base2"
Width="60"
Text="Space :"
FontWeight="Bold" />
<TextBlock Text="Panel functions open/close" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Width="{Binding ActualWidth, ElementName=base2}"
Text="F1 :"
FontWeight="Bold" />
<TextBlock Text="Mouse mode On/Off" />
</StackPanel>
</StackPanel> |
le binding sur le width marche tres bien
si je colle le tout dans un tool tips
ca ne marche plus
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
<Rectangle Fill="#FFF4F4F5"
HorizontalAlignment="Left"
Height="40"
Margin="40,0,0,84"
Stroke="Black"
VerticalAlignment="Bottom"
Width="104">
<Rectangle.ToolTip>
<StackPanel>
<TextBlock Text="Information functions"
FontWeight="Bold" />
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="base"
Width="60"
Text="Space :"
FontWeight="Bold" />
<TextBlock Text="Panel functions open/close" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="F1 :"
FontWeight="Bold"
Width="{Binding ActualWidth, ElementName=base}"/>
<TextBlock Text="Mouse mode On/Off" />
</StackPanel>
</StackPanel>
</Rectangle.ToolTip>
</Rectangle> |
bon j'ai bien trouvé une solution en collant
Code:
1 2 3 4 5 6 7 8
|
<StackPanel Orientation="Horizontal">
<TextBlock Width="{Binding Parent.Parent.Children[1].Children[0].Width,
RelativeSource={RelativeSource Self}}"
Text="toto"
FontWeight="Bold" />
<TextBlock Text="titi" />
</StackPanel> |
mais franchement c'est pas super sexy
quelqu'un a une idée plus sympa ?
merci