Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
unombun opened this issue Apr 23, 2024 · 4 comments · Fixed by #22854
Closed
Assignees
Labels
area-xaml XAML, CSS, Triggers, Behaviors p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@unombun
Copy link

unombun commented Apr 23, 2024

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 unombun added the t/bug Something isn't working label Apr 23, 2024
@jfversluis jfversluis added the area-xaml XAML, CSS, Triggers, Behaviors label Apr 23, 2024
@mikeparker104 mikeparker104 added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Apr 23, 2024
@PureWeen PureWeen added this to the .NET 8 SR5 milestone Apr 23, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 24, 2024
@Zhanglirong-Winnie
Copy link

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

@PureWeen PureWeen modified the milestones: .NET 8 SR5, .NET 8 SR6 Apr 25, 2024
@jsuarezruiz
Copy link
Contributor

image

@StephaneDelcroix
Copy link
Contributor

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
Copy link
Contributor

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

@PureWeen PureWeen modified the milestones: .NET 8 SR6, .NET 8 SR7 Jun 3, 2024
StephaneDelcroix added a commit that referenced this issue Jun 5, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
StephaneDelcroix added a commit that referenced this issue Jun 5, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
@PureWeen PureWeen modified the milestones: .NET 8 SR7, .NET 8 SR8 Jul 2, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
@PureWeen PureWeen modified the milestones: .NET 8 SR8, .NET 8 SR9 Jul 30, 2024
@PureWeen PureWeen added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Aug 2, 2024
@PureWeen PureWeen moved this from In Progress to Ready To Review in MAUI SDK Ongoing Aug 12, 2024
github-actions bot pushed a commit that referenced this issue Aug 12, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
@PureWeen PureWeen moved this from Ready To Review to In Progress in MAUI SDK Ongoing Aug 13, 2024
StephaneDelcroix added a commit that referenced this issue Sep 11, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
github-actions bot pushed a commit that referenced this issue Sep 18, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
github-actions bot pushed a commit that referenced this issue Sep 24, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
StephaneDelcroix added a commit that referenced this issue Sep 27, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
StephaneDelcroix added a commit that referenced this issue Sep 27, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
StephaneDelcroix added a commit that referenced this issue Oct 1, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
@PureWeen PureWeen modified the milestones: .NET 8 SR9, .NET 8 SR9.2 Oct 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing Oct 3, 2024
github-actions bot pushed a commit that referenced this issue Oct 3, 2024
when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001
jfversluis pushed a commit that referenced this issue Oct 4, 2024
…#25075)

* [X] allow namescope resolution before parenting

when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001

* fix

* fixes #16208

---------

Co-authored-by: Stephane Delcroix <stephane@delcroix.org>
rmarinho pushed a commit that referenced this issue Oct 16, 2024
* [X] allow namescope resolution before parenting

when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001

* fix

* fixes #16208
rmarinho pushed a commit that referenced this issue Oct 16, 2024
* [X] allow namescope resolution before parenting

when an element doesn't override the NameScope (DataTemplate, etc...)
FindName fails until the element is parented.

this PR sets a field (less expensive than a BP) used only during that
time, and allow VSM to be applied.

- fixes #22001

* fix

* fixes #16208
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

8 participants