Skip to content

[regression/8.0.3] Setting a style on a label causes spans with FontAttributes to be ignored on Android #19190

Open
@DamianMehers

Description

@DamianMehers

Description

Consider this .NET MAUI 8 XAML:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="TestAndroidSpans.MainPage">
    <ContentPage.Resources>
        <ResourceDictionary>
            <Style TargetType="Label">
                <Setter Property="TextColor" Value="Black"/>
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>

    <Label HorizontalOptions="CenterAndExpand" TextColor="Gray" >
        <Label.FormattedText>
            <FormattedString>
                <Span Text="{Binding NotBold}"/>
                <Span Text="{Binding Bold}" FontAttributes="Bold" />
            </FormattedString>
        </Label.FormattedText>
    </Label>
</ContentPage>

This generates:
Screenshot_1701706257

Notice that the Bold span is ignored.

If the Style is removed, everything works as expected:
Screenshot_1701706383

Steps to Reproduce

Create a new .NET 8 MAUI app and add the above XAML in the MainPage.xaml. Run the app. Notice the missing bold text

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

Unknown/Other

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-xamlXAML, CSS, Triggers, Behaviorshas-workaroundi/regressionThis issue described a confirmed regression on a currently supported versionpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/android 🤖s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions