Skip to content

[regression/8.0.3] Order of priority between Styles.xaml and custom css has changed in .net 8 #18980

@maestro-oc

Description

@maestro-oc

Description

After upgrading our project to .net 8 all of our custom css defined in a .css file and applied to a page/component is being overridden by the Style.xaml file. If the control exists in the Styles.xaml file then any css is ignored. If I remove the control type from the Styles.xaml file then the css works correctly.

Steps to Reproduce

  1. Create file -> new maui project
  2. Create Styles.css in /Resources/Styles
  3. Add record .test{ background-color: yellow;} to Styles.css
  4. Add StyleSheetExtension to MainPage.xaml
  5. Add new button with basic config and StyleClass="test"
  6. Run project and button will be default maui color
  7. Remove the Styles.xaml from the resource dictionary in App.xaml and re run the project, button will be yellow.

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.101

Affected platforms

Windows

Affected platform versions

Only tested on Windows 10

Did you find any workaround?

No no work around found

Relevant log output

No response

Metadata

Metadata

Labels

area-xamlXAML, CSS, Triggers, Behaviorsmigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/windowspotential-regressionThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions