maui
maui copied to clipboard
OrientationStateTrigger does not work if in the setters of the state TargetName is used
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
- Create a simple layout and use OrientationStateTrigger for custom layout based on orientation
- Inside the setters for each state use the TargetName to specify what controls should change their properties
- 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
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
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
yes, that's it. as a workaround, move the VSM at the page level and everything works.