You can use Binding.
You asked about DependencyProperty. So, you propably meant to a WPF solution.
Using WPF, you can set a name to your CheckBox
, like the following:
<CheckBox x:Name="cbEnableControls" Content="Enable controls"/>
and, bind the IsEnabled
property to the IsChecked
property of the CheckBox
, like the following:
<TextBox IsEnabled="{Binding IsChecked, ElementName=cbEnableControls}" />
But, the code example looks like WinForms. If you use Winforms, see the MSDN topic about the Binding class.