8000 Common Fluent.xaml for System ThemeMode by harshit7962 · Pull Request #10862 · dotnet/wpf · GitHub
[go: up one dir, main page]

Skip to content

Common Fluent.xaml for System ThemeMode #10862

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

Merged
merged 3 commits into from
May 21, 2025

Conversation

harshit7962
Copy link
Member
@harshit7962 harshit7962 commented May 21, 2025

Fixes #10846

Description

As explained in the issue above, setting ThemeMode to system led to crashes in DatePicker and NavigationWindow control. This was due to the fact that controls' ResourceDictionary was added as individual MergedDictionaries and the resolution of StaticResources being referenced in these controls was not part of these controls' itself. The current approach combines all the resources of controls, font, staticcolors, variables, and other common resources that were being used by both light and dark mode.
Given the above changes, the primary change of this PR is the update in ThemeGenerator script which includes the generation of newly configured Fluent.xaml.

Regression

Yes

Testing

Local Build pass
A complete testing on the gallery application in light and dark themes (with system theme mode)

Risk

Moderate

Microsoft Reviewers: Open in CodeFlow
8000

@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 05:03
@harshit7962 harshit7962 requested a review from a team as a code owner May 21, 2025 05:03
@dotnet-policy-service dotnet-policy-service bot added the PR metadata: Label to tag PRs, to facilitate with triage label May 21, 2025
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses crashes in the DatePicker and NavigationWindow controls that occur when ThemeMode is set to System. The changes update the ThemeGenerator script to include "System" as a theme mode and adjust the resource merging logic accordingly.

  • Added a new theme mode "System" to the themeColors array.
  • Updated conditional logic to generate a combined Fluent.xaml for the System theme.
  • Adjusted resource file handling to prevent incorrect merging for non-system themes.
Comments suppressed due to low confidence (1)

src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.Fluent.ps1:19

  • [nitpick] Verify that the variable name '$resouceFilesDir' is correct; if it is a typo, consider renaming it to '$resourceFilesDir' for improved readability.
$themeColorFilePath = Join-Path $resouceFilesDir "Theme\$themeColor.xaml"

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member
@dipeshmsft dipeshmsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
codecov bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 13.51442%. Comparing base (57fe8ac) to head (8b44fc1).
Report is 2 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10862         +/-   ##
===================================================
+ Coverage   13.48885%   13.51442%   +0.02557%     
===================================================
  Files           3317        3317                 
  Lines         664749      664749                 
  Branches       74643       74643                 
===================================================
+ Hits           89667       89837        +170     
+ Misses        572488      572278        -210     
- Partials        2594        2634         +40     
Flag Coverage Δ
Debug 13.51442% <ø> (+0.02557%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@harshit7962 harshit7962 merged commit ba62855 into dotnet:main May 21, 2025
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage Win 11 Theming
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatePicker crashes in Fluent theme
2 participants
0