Repository navigation
Closed
Labels
area-controls-labelLabel, Spanfixed-in-8.0.0-rc.2.9511Look for this fix in 8.0.0-rc.2.9511migration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androidplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working
Milestone
Description
Description
When changing the theme at runtime on Android or iOS, the implicit TextColor on a Label style is not being respected. Restarting the app is accurate. I tried .NET 8 RC2 and .NET 7 - 7.0.96.
<Label
SemanticProperties.HeadingLevel="Level2">
<Label.FormattedText>
<FormattedString>
<Span Text=".NET MAUI uses the latest technologies for building native apps on Windows, macOS, iOS, and Android, abstracting them into one common framework built on .NET." />
<Span Text=" "/>
<Span Text="Use a single C# codebase and project system for all device targets to build apps that look and feel like the native platforms." />
<Span Text=" "/>
<Span Text="Build beautiful apps faster and easier by integrating the power of Visual Studio with .NET MAUI." />
</FormattedString>
</Label.FormattedText>
</Label> <Style TargetType="Label">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}"/>
</Style>bad.mp4
Setting the same on a Span type style does work.
<Style TargetType="Span">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}"/>
</Style>good.mp4
Project:
Steps to Reproduce
Go into the styles.xaml file of the attached file and comment out this line
<Style TargetType="Span">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}"/>
</Style>- run the app
- change the theme of the device from light to dark (or visa versa) and notice that the text inside the span doesn't update.
Link to public reproduction project repository
No response
Version with bug
8.0.0-rc.2
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms (confirmed in attached)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
No response
Did you find any workaround?
Styling the Span instead of just the Label.
Relevant log output
No response
Reacted by Ashish Khanal, rtnk and Andreas
Metadata
Metadata
Assignees
Labels
area-controls-labelLabel, Spanfixed-in-8.0.0-rc.2.9511Look for this fix in 8.0.0-rc.2.9511migration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androidplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working
Type
Projects
- StatusShow more project fieldsDone
Activity
XamlTest commentedon Oct 16, 2023
Verified this on Visual Studio Enterprise 17.8.0 Preview 3.0(8.0.0-rc.2.9373). Repro on Android 13.0-API33 and iOS 16.4, not repro on Windows 11 with below Project:
templatetweak (2).zip
mattleibow commentedon Oct 17, 2023
Looking at the code, this code specifically does this:
Need to test on other platforms to see how they handle this.
mattleibow commentedon Oct 17, 2023