It is relatively easy. Everything should be resolved around the CheckBox IsChecked property. For a simple reason, this is a two-way property. Therefore, either you can change it, or CheckBox can change it.
So what you do, you are using MultiBinding, as such:
MultiBinding multiBinding = new MultiBinding(); multiBinding.Converter = multiBindingConverter; multiBinding.Bindings.Add(new Binding("Text") { Source = txtbox1}); multiBinding.Bindings.Add(new Binding("Text") { Source = txtbox2}); multiBinding.NotifyOnSourceUpdated = true;//this is important. checkBox.SetBinding(CheckBox.IsCheckedProperty, multiBinding);
And in your MultiBindingConverter you will have the value of the object [] as the first parameter that you need to convert to IList and iterate over it && & do your calculations if you must either return true / false. (IsChecked = true or false)
Now bind the CheckBox IsEnabled property to the CheckBox IsChecked property and use the BooleanInverterConverter. (If CheckBox is installed, it must be disabled and vice versa)
The final step is to get TextBoxes to listen on the actual IsChecked CheckBox property. If it is TRUE, they all must show the value 0, otherwise they can show what they want.
So create a new MultiBinding.
MultiBinding multiBinding = new MultiBinding(); multiBinding.Converter = textboxMultiBindingConverter; multiBinding.Bindings.Add(new Binding("IsChecked") { Source = checkbox1}); multiBinding.Bindings.Add(new Binding("Text") { Source = textbox1}); multiBinding.NotifyOnSourceUpdated = true;//this is important. textbox1.SetBinding(TextBox.Text, multiBinding);
The idea in textboxMultiBindingConverter is to either return the text (value [1]) if the value is [0] == FALSE or "0" if the value is [0] == TRUE.
source share