I have a textbox inside a style, whose text property is bound to the name property of my object here is the code:
<Style TargetType="s:Node">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl">
<TextBox x:Name="textboxName" Text="{Binding Source={RelativeSource TemplatedParent}, Path=Tag, Mode=TwoWay}" IsHitTestVisible="False"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Inside the constructor for node I have:
public Node()
{
Name = "node";
Tag = 100;
}
I am not sure what I am doing wrong, any help would be appreciated.
Sourcedoes not process aRelativeSourcethe way theBindingdoes when set asBinding.RelativeSourcebut just takes that markup extension object and looks for properties on it.A
RelativeSourcedescribes how a relative source should be found and should hence not be used directly as theSourcefor a binding.