Reputation: 2665
Text="{Binding MyTextProperty, RelativeSource={RelativeSource FindAncestor,
AncestorType=local:MyUserControl}}"
in the above code, i can get the MyUserControl
as my source but the MyTextProperty
is in another control which inside the MyUserControl
. so i can use a converter and get the 'MyUserControl' and return the corresponding control as Source.
is this possible?
Upvotes: 0
Views: 34
Reputation: 128070
You could expose the inner control as a public property in MyUserControl:
public class MyUserControl
{
public MyInnerControl InnerControl { get; set; }
}
and use it in the property path of your binding like this:
Text="{Binding InnerControl.MyTextProperty,
RelativeSource={RelativeSource FindAncestor, AncestorType=local:MyUserControl}}"
Upvotes: 1