Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Indirect (or two level) Binding

 
 
Old 08-17-2006   #1 (permalink)
Patrice Ongla


 
 

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 SpecsSystem Spec
Old 08-17-2006   #2 (permalink)
Patrice Ongla


 
 

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 SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46