We can bind properties of controls to Data Context like
Is there any way to bind control to existing Control in Code behind ?
If i already have text box in My Data context is there any way to bind this textbox in XAML to another text box.
We can bind properties of controls to Data Context like
Is there any way to bind control to existing Control in Code behind ?
If i already have text box in My Data context is there any way to bind this textbox in XAML to another text box.
You cannot bind all the properties from one control to another control in datacontext automatically. But you can bind your entire control from DataContext
into ContentControl
as Content
.
Let's say you have 'MyTextBox' property in your current DataContext
. Then in XAML you can do the following:
<ContentControl Content="{Binding MyTextBox}" />
Which probably should work (if you do not assign MyTextBox
as child somewhere else also)