Skip to content

ThemeMode style not applying to TextBlock in a Page #10759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
safreed-msft opened this issue Apr 11, 2025 · 4 comments
Closed

ThemeMode style not applying to TextBlock in a Page #10759

safreed-msft opened this issue Apr 11, 2025 · 4 comments
Labels
Investigate Requires further investigation by the WPF team. Win 11 Theming

Comments

@safreed-msft
Copy link

safreed-msft commented Apr 11, 2025

Description

I'm trying out the new fluent ui theming in .NET 9 but hit an issue where the theme styles aren't inherited by pages. (update: Seems to only be for TextBlocks?)

Image

Reproduction Steps

  1. Create new WPF project with .NET 9
  2. Set ThemeMode="Dark" in App.xaml
  3. Create a Page with just a TextBlock
  4. In MainWindow.xaml, add a Frame and navigate to the created Page

Expected behavior

Page's textblock is styled appropriately (light foreground color since background is dark)

Actual behavior

Text foreground is dark

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

@safreed-msft safreed-msft changed the title ThemeMode style not applying to pages ThemeMode style not applying to TextBlock in a Page Apr 11, 2025
@himgoyalmicro himgoyalmicro added Investigate Requires further investigation by the WPF team. Win 11 Theming labels Apr 14, 2025
@dipeshmsft
Copy link
Member

dipeshmsft commented Apr 14, 2025

Hey @safreed-msft, yes this is a known issue with Page, one simple workaround for this is to add the Foreground="{DynamicResource TextFillColorPrimaryBrush}" as an attribute of Page tag.

@safreed-msft
Copy link
Author

Thanks for the confirmation @dipeshmsft! I'm looking forward to these issues being resolved to bring a much-needed good default theme to WPF!

@dipeshmsft
Copy link
Member

@safreed-msft, this is more of a limitation of implicit styles. Implicit styles are not loaded for derived types. We did some workarounds for Window and put it in WPF for now. But this was difficult to do for Page, hence we left it this way. The real solution will be that we load the Fluent styles in default style and we are working on that now.

Given this, if you are okay, can I go ahead and close this issue.

@safreed-msft
Copy link
Author

I see, thanks for the explanation. Yes this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Requires further investigation by the WPF team. Win 11 Theming
Projects
None yet
Development

No branches or pull requests

3 participants