WPF binding only inside XAML (simple question)

Posted by 0xDEAD BEEF on Stack Overflow See other posts from Stack Overflow or by 0xDEAD BEEF
Published on 2010-03-13T20:57:51Z Indexed on 2010/03/13 21:05 UTC
Read the original article Hit count: 701

Filed under:
|
|
|
|

Why this works

<myToolTip:UserControl1>
   <TextBlock Text="{Binding Path=TestString, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type myToolTip:UserControl1}}}"/>
</myToolTip:UserControl1>

BUT this does not

<myToolTip:UserControl1 x:Name="userControl">
   <TextBlock Text="{Binding Path=TestString, ElementName=userControl}"/>
</myToolTip:UserControl1>

and is there realy no shorter (faster) fay, to acces usercontrols elements?! Sincerely, 0xDEAD BEEF

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml