Data Binding to an Element

By Michael Detras

Shows an example on how to bind to a property of a UI element using XAML.

This example shows how to bind the IsEnabled property of a TextBox to the IsChecked property of the CheckBox. It only means that the CheckBox lets you enable or disable the TextBox, without using event handlers in code-behind.

<CheckBox x:Name="MyCheckBox"/>
<TextBox IsEnabled="{Binding ElementName=MyCheckBox, Path=IsChecked}"/>

Related FAQs

Bind properties to your control without the XAML.
This shows how to bind a dependency property to more than 1 binding source using multi-binding.
Data Binding to an Element  (1773 Views)