I have a custom MyControl : UserControl with dependency property
string Text
Inside the MyControl in XAML I have a TextBox.
I wish to bind the Text dependency property of MyControl to the Text dependency property of the TextBox.
What is the best way to do this? Can I declare the dependency property of
MyControl to pass through to the child depenendency property?
The easiest way is to assign a
x:Name="root"attribute to the root of yourMyControl.xamlfile, and then use a binding like this for yourTextBox:(You can specify your own name for
root.)