dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.99k stars 1.72k forks source link

DataTrigger stops reacting on value change #10189

Open dmironiuk opened 1 year ago

dmironiuk commented 1 year ago

Description

When there are two DataTriggers and binding values are changed the same time one of the bound property does not fire the corresponding trigger correctly.

I've create a demo project here: https://github.com/dmironiuk/DataTriggerBugInMaui

Using of DataTriggers: https://github.com/dmironiuk/DataTriggerBugInMaui/blob/master/DataTriggerBugInMaui/MainPage.xaml

Basically it looks like this:

  1. After application start (correct) https://github.com/dmironiuk/DataTriggerBugInMaui/blob/master/Screenshots/after-start.png

  2. After fist click on "Switch both" (correct) https://github.com/dmironiuk/DataTriggerBugInMaui/blob/master/Screenshots/first-click-on-switch-both.png

  3. After second click on "Switch both" (incorrect) https://github.com/dmironiuk/DataTriggerBugInMaui/blob/master/Screenshots/second-click-on-switch-both.png

  4. After switching single property IsCurrentMonth (correct) https://github.com/dmironiuk/DataTriggerBugInMaui/blob/master/Screenshots/is-current-month-toggled-on.png

  5. After switching back single property IsCurrentMonth (correct) https://github.com/dmironiuk/DataTriggerBugInMaui/blob/master/Screenshots/is-current-month-toggled-off.png

% dotnet --version
6.0.401

I tested it on Xamarin and there is the same problem.

I tried to experiment with triggers order - the same behaviour

Steps to Reproduce

Run the project and play with buttons

Link to public reproduction project repository

https://github.com/dmironiuk/DataTriggerBugInMaui

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

Android, macOS

Affected platform versions

Android API 31

Did you find any workaround?

No response

Relevant log output

No response

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

PureWeen commented 1 year ago

@StephaneDelcroix thoughts?

widavies commented 1 year ago

@PureWeen Can you review #15655 and let me know if it seems like a decent solution to this? Thanks.

widavies commented 1 year ago

The work around for the moment is to not use multiple DataTrigger's. Instead set any target properties in the behind-C# code.