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.22k stars 1.75k forks source link

AppThemeBinding does not work on ToolbarItems #24878

Closed Moes81 closed 1 month ago

Moes81 commented 1 month ago

Description

Hi all,

I didn't find a report that fitted my description, that's why I created a new one. Please feel free to close it as duplicate if I missed the existing report.

In Styles.xaml we can set a style for TargetType="Shell" and set an AppThemeBinding for Shell.TitleColor. As far as I understand this color is used for the page title as well as for the ToolbarItems and I expect that the color of the ToolbarItems is by default the same as for the Title. If I now change the theme from light to dark, or dark to light, depending on with which theme you started the app, I would expect that the ToolbarItems change their color according to the theme. Unfortunately, the color remains the same.

Screenshot 2024-09-23 at 17 19 29 Screenshot 2024-09-23 at 17 19 40

I was able to reproduce the behaviour on:

Steps to Reproduce

  1. Create a new MAUI solution
  2. update Microsoft.Maui.Controls and .Compatibility to 8.0.90
  3. Add one or more ToolbarItems to the MainPage.xaml or to AppShell.xaml
  4. Run the app
  5. Switch from light to dark theme

Expected: The ToolbarItem color changes according to the AppThemeBinding in style Shell.TitleColor and thus have the same color as the title.

Actual: The ToolbarItem color does not change remains black.

Alternative: Check out and run my sample project (see below).

Link to public reproduction project repository

https://github.com/Moes81/maui_toolbaritems_themecolor

Version with bug

8.0.90 SR9

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 8 and greater, iOS 17.6.1

Did you find any workaround?

No workaround found so far.

Relevant log output

No response

github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

SmartmanApps commented 1 month ago

Not sure if https://github.com/dotnet/maui/issues/6748 is related, but there's been issues with ToolbarItem colours for a long time! (wish this would get fixed)