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

Implicit styling on .NET 8 is being ignored on the page level #19820

Open
BFuchshofer opened this issue Jan 11, 2024 · 7 comments
Open

Implicit styling on .NET 8 is being ignored on the page level #19820

BFuchshofer opened this issue Jan 11, 2024 · 7 comments
Labels
area-xaml XAML, CSS, Triggers, Behaviors migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Milestone

Comments

@BFuchshofer
Copy link

Description

The implicit styling set on the page level does not utilize implicit styling on the application level.

Example:
There is a styling with TargetType="Label" on the application level that sets the TextColor to Red and the background color to Yellow.
There is a Label on the MainPage with no inline styling set.
However, on the page level, there exists a styling with TargetType="Label" and a Setter for the TextColor set to Green.

The expected behavior is that the Label has a Green TextColor and a Yellow BackgroundColor.
The behavior on .NET 7 and .NET 8 is different.
It works on .NET 7 but not on .NET 8.
On .NET 8, all stylings from the application level are being ignored.

.Net 7
Screenshot_20240111_110339

.Net 8
Screenshot_20240111_110331

Steps to Reproduce

No response

Link to public reproduction project repository

https://github.com/BFuchshofer/StyleTest

Version with bug

8.0.5

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI, Yes, this used to work in Xamarin.Forms

Last version that worked well

7.0.101

Affected platforms

iOS, Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@BFuchshofer BFuchshofer added the t/bug Something isn't working label Jan 11, 2024
@jsuarezruiz jsuarezruiz added the area-xaml XAML, CSS, Triggers, Behaviors label Jan 11, 2024
@samhouts samhouts added potential-regression This issue described a possible regression on a currently supported version., verification pending migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert labels Jan 11, 2024
@PureWeen PureWeen added this to the Backlog milestone Jan 11, 2024
@ghost
Copy link

ghost commented Jan 11, 2024

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@BFuchshofer
Copy link
Author

It looks like Styles set over VisualStateGroups on Applicationlevel still work on Page Level when used in an implicit Style (no x:Key set, just TargetType).

@Alex-J-Lopez
Copy link

It looks like Styles set over VisualStateGroups on Applicationlevel still work on Page Level when used in an implicit Style (no x:Key set, just TargetType).

I've been looking for a work around for nearly all of my global styles breaking when I moved to .net 8.0 and I used your work around to fix my issue so thank you. It appears that when you specify a visual state setter globally and then specify some property at the page level for any control, it overrides the global style unless its inside of the normal state.

@BFuchshofer
Copy link
Author

I really wonder why there are no other developers experiencing this issue. I couldn't find any other evidence that this problem exists for other people. So, I wonder what I am doing wrong.

@Alex-J-Lopez
Copy link

I've been looking around and I also can't seem to find any other instance of this happening. I've converted all of my styles to set properties inside of the normal visual state which seems to fix the issue for me. So long as I overwrite the styles in the normal visual state in the content page, it still accepts the global style.

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Feb 18, 2024
@XamlTest
Copy link
Collaborator

Verified this on Visual Studio Enterprise 17.10.0 Preview 1(8.0.6). Repro on Windows 11, Android 14.0-API34, iOS 17.2 and MacCatalyst with below Project:
StyleTest.zip

@BaY1251
Copy link

BaY1251 commented Jun 11, 2024

It's too scary, I have to add a lot of code

@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants