maui icon indicating copy to clipboard operation
maui copied to clipboard

OrientationStateTrigger does not work if in the setters of the state TargetName is used

Open unombun opened this issue 1 year ago • 3 comments

Description

Using OrientationStateTrigger with some setters using TargetName does not work properly/ crashes the app. This depends if the debug is attached or not.

Steps to Reproduce

  1. Create a simple layout and use OrientationStateTrigger for custom layout based on orientation
  2. Inside the setters for each state use the TargetName to specify what controls should change their properties
  3. The OrientationStateTrigger does not apply the correct values or it crashed the app. Expected behavior: The layout should change accordingly with the specified setters and app should not crash.

Link to public reproduction project repository

https://github.com/flesarradu/SimpleVisualStateManager

Version with bug

8.0.14 SR3.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

No response

Did you find any workaround?

Try not to use TargetName in Setter, however this means for each control you need to define again and again the states instead of having just one place to define all the needed changes.

Relevant log output

No response

unombun avatar Apr 23 '24 11:04 unombun

Verified this issue with Visual Studio 17.10.0 Preview 4(8.0.20&8.0.14). Can repro on iOS and Android platforms with sample project. https://github.com/flesarradu/SimpleVisualStateManager

Zhanglirong-Winnie avatar Apr 24 '24 05:04 Zhanglirong-Winnie

image

jsuarezruiz avatar May 06 '24 06:05 jsuarezruiz

the scoping issue can be solved by moving the VSM one level higher (at the Page level). The original visibility is then correct. Trying to reproduce the orientation change in a unit test to make sure this workaround works, before figuring out if it's possible to fix the original issue, or not

StephaneDelcroix avatar May 23 '24 10:05 StephaneDelcroix

yes, that's it. as a workaround, move the VSM at the page level and everything works.

StephaneDelcroix avatar Jun 03 '24 12:06 StephaneDelcroix