I have a very simple UserControl
one called CustomTextBox
with this XAML:
<UserControl x:Class="CustomTextBox" ... >
<Grid>
<TextBox x:Name="InnerTextBox"/>
</Grid>
</UserControl>
Now when I use CustomTextBox
and want to bind to InnerTextBox.Text
, it does not work:
... {Binding ElementName=CustomTextBox, Path=InnerTextBox.Text}
I tried it differently, it doesn't work:
... {Binding ElementName=CustomTextBox.InnerTextBox, Path=Text}
I know that I can define a new dependency property called CustomTextBox.Text
and then bind it to InnerTextBox.Text
, but I plan to have custom controls with many properties, and it’s damn hard to copy all of them just to support the binding. In addition, copy / wrapping properties mean that each value is stored twice.
WinForms , . WPF XAML .
UserControl
?