Page 1 of 1

MenuItem with bound IsChecked overridden by click

Posted: 19 Nov 2024, 01:58
by TheHappyYachter
Hi,

In Unity with Noesis 3.2.5 I have been using a MenuItem which is databound to an object which implements a UniRx ReactiveProperty IsChecked via "{Binding IsChecked.Value, Mode=OneWay}". I have two places this same object is Bound. One in a context menu for which the visual elements are recreated each time the menu is opened. In this menu the IsChecked property is always correct. In the other case the menu is a persistent control, where the checkbox can become desynchronised from the backing property.

It seems that Clicking on the MenuItem always sets the state of the check irrespective of the Binding? Is this the expected behaviour and are there any ways I could work around this?

Thanks.

Re: MenuItem with bound IsChecked overridden by click

Posted: 19 Nov 2024, 10:53
by sfernandez
Hello, if I understood correctly what is happening is that binding stops working after clicking the MenuItem/ToggleButton. If that is the case this could be related to a known issue: https://www.noesisengine.com/bugs/view.php?id=3009

The problem is that currently a OneWay binding gets removed when a ToggleButton is clicked because it is directly setting the local value of the IsChecked property. We need to change the implamentation so it modifies the current value instead without affecting the stored binding expression.

In the meantime, if you use a TwoWay binding it should respect the binding when you click.