I have a ToggleButton
with its IsChecked
property bound to a property using a OneWay binding.
I have similar problem.
It is not "the binding seems to get lost" (unless it's earlier frameworks problems). Binding continues working and can be easily proved by changing property outside of that command (e.g. in handler of another button click event/command).
The problem is what IsChecked
can be changed in two ways: 1) binding (when value of SomeProperty
is changed button will be updated 2) user (if user press button he will change IsChecked
, but binding is OneWay
so SomeProperty
will not be updated).
So you may have desync occurs when SomeProperty == false
but button IsChecked == true
or vice-versa.
To optimize performance binding mechanism is checking if new value is different from current. So if desync occurs and you try to update SomeProperty
with the value which it already have, then nothing will happens.
Workaround is simple: update property in 2 steps
SomeProperty = !set;
SomeProperty = set;
where set
is the value you need (e.g. opposite to current SomeProperty
).