-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
There was a problem hiding this 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"
src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.Fluent.ps1
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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 individualMergedDictionaries
and the resolution ofStaticResources
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