TheHappyYachter
Topic Author
Posts: 4
Joined: 19 Nov 2024, 01:47

MenuItem with bound IsChecked overridden by click

19 Nov 2024, 01:58

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.
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: MenuItem with bound IsChecked overridden by click

19 Nov 2024, 10:53

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.

Who is online

Users browsing this forum: No registered users and 2 guests