I have a CheckBox and a TextBox. During the runtime,
if the CheckBox is Checked then the TextBox is enabled.
I did it using following code
private void checkTime_Checked(object sender, RoutedEventArgs e)
{
if (checkTime.IsChecked == true)
{
txtTime_SR.IsEnabled = true;
}
}
What I need to do is, to disable the TextBox when the CheckBox is Unchecked during runtime.
Any idea of doing this ?
Reading your post and comments, I'll guess you are doing WPF or silverlight. Then, in that case, you may do it all in XAML :
<CheckBox x:Name="checkTime" />
<TextBox x:Name="txtTime_SR" IsEnabled="{Binding IsChecked, ElementName=checkTime, Converter={StaticResource NotConverter}, Mode=OneWay}"/>
Then, you need to create the converter. This can be done by reading post here : How to bind inverse boolean properties in WPF?
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With