dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.03k stars 1.73k forks source link

TableSection.TextColor does not work with DynamicResource #21456

Open janusw opened 6 months ago

janusw commented 6 months ago

Description

Setting the TextColor of a TableSection via DynamicResource does not work.

<TableView>
    <TableRoot>
        <TableSection Title="SomeTitle" TextColor="{DynamicResource SomeColor}">
        </TableSection>
    </TableRoot>
</TableView>

Using a color code directly or a StaticResource works well. The problem occurs also with AppThemeBinding:

<TableSection Title="SomeTitle"
              TextColor="{AppThemeBinding Light={DynamicResource Color1}, Dark={DynamicResource Color2}}">

This is basically a repost of #8487, which was closed without a fix.

Steps to Reproduce

  1. git clone git@github.com:janusw/maui-samples.git
  2. git checkout TableSection_TextColor_bug_repro
  3. Open 8.0/UserInterface/Views/TableViewDemos/TableViewDemos.sln, build and run it.
  4. Observe the missing coloring of the TableSection on the MainPage and SettingsIntentPage.

I added the same text coloring for a TextCell / Label in each case, in order to show that it works well there.

Link to public reproduction project repository

https://github.com/janusw/maui-samples/tree/TableSection_TextColor_bug_repro

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

seen on Android 14, iOS 16 & 17

Did you find any workaround?

No response

Relevant log output

No response

jaosnz-rep commented 6 months ago

Can repro this issue at Android & iOS platform on the latest 17.10 preview2 (8.0.14 &8.0.7)

Phenek commented 6 months ago

So the documentation about DynamicResource here does not work... here learn.microsoft.com/theming

You're going to give me a heart attack one of these days! Regards,

janusw commented 6 months ago

So the documentation about DynamicResource here does not work... here learn.microsoft.com/theming

Well, in general DynamicResource works well in most places for me (e.g. with Label.TextColor and other properties). It only fails for TableSection.TextColor AFAICT.

munkii commented 2 weeks ago

FWIW this was raised back in 2022 too but closed because of no repro, https://github.com/dotnet/maui/issues/8487. It is still an issue today with version 8.0.80

Unless I am mistaken this makes a DarkMode impossible for most semi complex apps that will be using a TableView for at least their settings page.