![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Indirect (or two level) Binding Hi Everyone, In XAML, I'm trying to retrieve the value of a numerical dependentproperty (say MyRectangle2.Height ) that is databound to another (say MyRectangle2.Height so MyRectangle1.Height = MyRectangle2.Height that is 10). I expected to get the value resulting of this binding (10) but I only get the NaN value. How to get the value (of the indirection) ? I precize that I got It working once but I can't anymore, don't ask me why... : ) Hope I'm clear. If I'm not, have a look on the sample code above. In it we can see that the two level binding doesn't work either for a string property. Thanx in advance. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="DemoPbNaN" x:Class="PbNan.WinDemoPbNaN" Title="DemoPbNaN" SizeToContent="WidthAndHeight" > <StackPanel x:Name="StackPanel" > <TextBox x:Name="TXB_Test" Text="Test" TextWrapping="Wrap" AcceptsReturn="True" /> <TextBlock x:Name="TBK_Bound1" Height="{Binding Height, ElementName=Txtb_Test, Mode=Default}" Text="{Binding Text, ElementName=Txtb_Test, Mode=Default}" Background="Blue" /> <TextBlock x:Name="TBK_Bound2a" Background="Red" Margin="2" Height="{Binding Height, ElementName=Txtb_Test, Mode=Default}" Text="{Binding Text, ElementName=TextBlock, Mode=Default}"/> <TextBlock x:Name="TBK_Bound2b" Background="Red" Margin="2" Text="{Binding Height, ElementName=TextBlock, Mode=Default}" /> </StackPanel> </Window> |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Indirect (or two level) Binding --> How to bind a non hardcoded value OK, that's not a matter of indirection. It's more general. It's a matter of hardcoded value or not. If the bound value is not hardcoded (e.g. bound value or auto value) it doesn't work... "Patrice Ongla" <patrice.ongla@wanadoo.fr> a écrit dans le message de news: OapAkehwGHA.2232@TK2MSFTNGP05.phx.gbl... > Hi Everyone, > > In XAML, I'm trying to retrieve the value of a numerical dependentproperty > (say MyRectangle2.Height ) that is databound to another (say > MyRectangle2.Height so MyRectangle1.Height = MyRectangle2.Height that is > 10). I expected to get the value resulting of this binding (10) but I only > get the NaN value. > How to get the value (of the indirection) ? > > I precize that I got It working once but I can't anymore, don't ask me > why... : ) > > Hope I'm clear. If I'm not, have a look on the sample code above. In it we > can see that the two level binding doesn't work either for a string > property. > > Thanx in advance. > > > <Window > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > x:Name="DemoPbNaN" x:Class="PbNan.WinDemoPbNaN" Title="DemoPbNaN" > SizeToContent="WidthAndHeight" > > > <StackPanel x:Name="StackPanel" > > > <TextBox x:Name="TXB_Test" Text="Test" TextWrapping="Wrap" > AcceptsReturn="True" /> > > <TextBlock x:Name="TBK_Bound1" > Height="{Binding Height, ElementName=Txtb_Test, Mode=Default}" > Text="{Binding Text, ElementName=Txtb_Test, Mode=Default}" > Background="Blue" /> > > <TextBlock x:Name="TBK_Bound2a" Background="Red" Margin="2" > Height="{Binding Height, ElementName=Txtb_Test, Mode=Default}" > Text="{Binding Text, ElementName=TextBlock, Mode=Default}"/> > > <TextBlock x:Name="TBK_Bound2b" Background="Red" Margin="2" > Text="{Binding Height, ElementName=TextBlock, Mode=Default}" /> > > </StackPanel> > > > </Window> > > |
My System Specs![]() |