Is there a way to bind a bool to a checkbox ischecked property, and automatically update this property if the UI changes?
<CheckBox IsChecked="{Binding Path=IsFilterOn}" />
public bool IsFilterOn {
get;
set;
}
What changes do I need to make to this?
Put the binding in to two way mode:-
<CheckBox IsChecked="{Binding Path=IsFilterOn, Mode=TwoWay}" />
If you want the UI to update if other code changes the property on the object you should also implement INotifyPropertyChanged
on your object. You will then have full bi-lateral observation on the property.
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