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

Styles based on other styles not applied #27202

Open
lucacivale opened this issue Jan 17, 2025 · 3 comments
Open

Styles based on other styles not applied #27202

lucacivale opened this issue Jan 17, 2025 · 3 comments
Assignees
Labels
area-xaml XAML, CSS, Triggers, Behaviors i/regression This issue described a confirmed regression on a currently supported version partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 regressed-in-9.0.0 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@lucacivale
Copy link

Description

With MAUI v8 we could create styles based on other styles

<Style x:Key="BaseLabel" TargetType="Label">
    <Setter Property="BackgroundColor" Value="Transparent" />
    <Setter Property="FontFamily" Value="OpenSansRegular" />
    <Setter Property="FontSize" Value="20" />
    <Setter Property="VisualStateManager.VisualStateGroups">
        <VisualStateGroupList>
            <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Disabled">
                    <VisualState.Setters>
                        <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateGroupList>
    </Setter>
</Style>

<Style BasedOn="{StaticResource BaseLabel}" TargetType="local:MyLabel">
    <Setter Property="TextColor" Value="Green" />
</Style>

<Style BasedOn="{StaticResource BaseLabel}" TargetType="local:MyLabel2">
    <Setter Property="TextColor" Value="Blue" />
</Style>
<VerticalStackLayout Padding="30,0" Spacing="25">
    <local:MyLabel Text="Label with derrived style with derrived disabled visual state" />
    <local:MyLabel2 Text="Label with derrived style with explicit disabled visual state" />
    <local:MyLabel IsEnabled="False" Text="Disabled label with derrived style with derrived disabled visual state" />
    <local:MyLabel2 IsEnabled="False" Text="Disabled label with derrived style with explicit disabled visual state" />
</VerticalStackLayout>

Image

This does not work with MAUI 9.0.30 anymore
Image

Steps to Reproduce

  1. Create custom control derived from label. No other customizations needed
  2. Create the styles as in Description described
  3. Create a new ContentPage with the VerticalStackLayout as in Description described.

Link to public reproduction project repository

No response

Version with bug

9.0.30 SR3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.100 SR10

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

Set VisualStates explicit on derived styles.

<Style BasedOn="{StaticResource BaseLabel}" TargetType="local:MyLabel2">
    <Setter Property="TextColor" Value="Blue" />
    <Setter Property="VisualStateManager.VisualStateGroups">
        <VisualStateGroupList>
            <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Disabled">
                    <VisualState.Setters>
                        <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateGroupList>
    </Setter>
</Style>

Image

Relevant log output

@lucacivale lucacivale added the t/bug Something isn't working label Jan 17, 2025
@jfversluis jfversluis added area-xaml XAML, CSS, Triggers, Behaviors potential-regression This issue described a possible regression on a currently supported version., verification pending labels Jan 17, 2025
@jfversluis
Copy link
Member

Does it work on earlier .NET 9 versions? So we can get closer to where things started working differently

@lucacivale
Copy link
Author

@jfversluis Doesn't work on 9.0.0, 9.0.10 and 9.0.21 either

@Ying-6 Ying-6 added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage i/regression This issue described a confirmed regression on a currently supported version labels Jan 20, 2025
@Marnie-Majait
Copy link

Marnie-Majait commented Jan 20, 2025

This issue has been verified Visual Studio 17.13 Preview 2.1 (9.0.30 & 9.0.22 & 9.0.0). Can repro this issue on android platform. 8.0.100 & 8.0.3 works fine.

8.0.100:

Image

9.0.30:

Image

@jfversluis jfversluis removed the potential-regression This issue described a possible regression on a currently supported version., verification pending label Jan 20, 2025
@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 22, 2025
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 i/regression This issue described a confirmed regression on a currently supported version partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 regressed-in-9.0.0 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

8 participants