KEMBAR78
[Proposal] Removed the default span styling from the template by kubaflo · Pull Request #28818 · dotnet/maui · GitHub
Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Apr 6, 2025

Description of Change

Some developers prefer to use global styles for their Label controls and expect that properties like TextColor will cascade to Span. However, the default Styles.xaml file in the MAUI template includes an explicit style targeting Span, which overrides inherited properties—specifically TextColor.

This default Span style unnecessarily duplicates the TextColor of Label, causing confusion when global styles don't behave as expected. Removing the Span style resolves the issue by allowing properties such as TextColor to be inherited from the parent Label, as intended.

This change simplifies styling and ensures a more consistent and predictable behavior for developers customizing label appearance via global styles.

@Copilot Copilot AI review requested due to automatic review settings April 6, 2025 18:18
@kubaflo kubaflo requested a review from a team as a code owner April 6, 2025 18:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (3)
  • src/Controls/samples/Controls.Sample.Embedding/Resources/Styles/Styles.xaml: Language not supported
  • src/Templates/src/templates/maui-mobile/Resources/Styles/Styles.xaml: Language not supported
  • src/Templates/src/templates/maui-multiproject/MauiApp.1/Resources/Styles/Styles.xaml: Language not supported

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Files not reviewed (3)
  • src/Controls/samples/Controls.Sample.Embedding/Resources/Styles/Styles.xaml: Language not supported
  • src/Templates/src/templates/maui-mobile/Resources/Styles/Styles.xaml: Language not supported
  • src/Templates/src/templates/maui-multiproject/MauiApp.1/Resources/Styles/Styles.xaml: Language not supported

@kubaflo kubaflo changed the title Removed the default span styling from the template [Proposal] Removed the default span styling from the template Apr 6, 2025
@kubaflo kubaflo self-assigned this Apr 6, 2025
@kubaflo kubaflo added the community ✨ Community Contribution label Apr 6, 2025
@pictos
Copy link
Contributor

pictos commented Apr 6, 2025

AFAIK the Label style doesn't go down to Spans, is that different for TextColor?

@kubaflo
Copy link
Contributor Author

kubaflo commented Apr 6, 2025

They used not to but currently they do. And, I think that it has been put in the template because it didn't work in the past

    <ContentPage.Resources>
        <Style TargetType="Label">
            <Setter Property="TextColor"
                    Value="Green"/>
            <Setter Property="FontSize"
                    Value="35"/>
        </Style>
    </ContentPage.Resources>
    <Label>
        <Label.FormattedText>
            <FormattedString>
                <Span>Hello</Span>
                <Span Text=" World"/>
            </FormattedString>
        </Label.FormattedText>
    </Label>

@kubaflo kubaflo added proposal/open area-templates Project templates, Item Templates for Blazor and MAUI labels Apr 7, 2025
@PureWeen
Copy link
Member

PureWeen commented Aug 6, 2025

/rebase

@github-actions github-actions bot force-pushed the maui-span-template branch from d399ad6 to cf98695 Compare August 6, 2025 23:05
@PureWeen
Copy link
Member

PureWeen commented Aug 6, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current August 7, 2025 20:58
@PureWeen PureWeen merged commit 707b419 into dotnet:inflight/current Aug 7, 2025
119 of 129 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-templates Project templates, Item Templates for Blazor and MAUI community ✨ Community Contribution partner/syncfusion/review proposal/open

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants