-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixed DataGrid column header text color in HC mode #10956
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
base: main
Are you sure you want to change the base?
Fixed DataGrid column header text color in HC mode #10956
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 fixes low visibility of DataGrid column header text in high contrast mode by introducing a new resource, DataGridColumnHeaderForeground, and using it in multiple theme files.
- Introduces a new SolidColorBrush resource for DataGridColumnHeaderForeground in several theme files.
- Applies the new resource via a Setter in the DefaultDataGridColumnHeaderStyle in each theme.
- Updates both HC and conventional themes to use the new color resource ensuring consistent visibility across modes.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
Fluent.xaml | Adds a Foreground Setter referencing the new resource in the default DataGridColumnHeader style. |
Fluent.Light.xaml | Introduces the DataGridColumnHeaderForeground brush and applies it via the style. |
Fluent.HC.xaml | Defines the HC-specific DataGridColumnHeaderForeground brush and updates the header style accordingly. |
Fluent.Dark.xaml | Adds the new Foreground Setter and brush for Dark theme. |
DataGrid.xaml | Updates the DataGrid header style to use the dynamic resource for Foreground. |
Theme/Light.xaml | Adds the brush definition for DataGridColumnHeaderForeground in Light theme resources. |
Theme/HC.xaml | Updates HC theme resources with the new brush definition. |
Theme/Dark.xaml | Inserts the new brush definition for Dark theme resources. |
Comments suppressed due to low confidence (2)
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DataGrid.xaml:407
- Add tests to verify that the DataGrid column header renders with the correct foreground color in both normal and high contrast modes. This will help ensure that the fix consistently improves header visibility across themes.
<Setter Property="Foreground" Value="{DynamicResource DataGridColumnHeaderForeground}" />
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml:373
- Ensure that the SystemColorButtonTextColor used for DataGridColumnHeaderForeground in HC mode provides sufficient contrast for accessibility guidelines. Consider validating this color choice against accessibility standards.
<SolidColorBrush x:Key="DataGridColumnHeaderForeground" Color="{StaticResource SystemColorButtonTextColor}" />
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10956 +/- ##
===================================================
- Coverage 13.52892% 13.45748% -0.07144%
===================================================
Files 3319 3319
Lines 664894 664894
Branches 74674 74674
===================================================
- Hits 89953 89478 -475
- Misses 572398 572864 +466
- Partials 2543 2552 +9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Description
In HC mode, the DataGrid column header text color was not visible. DataGrid column header was inheriting foreground color from the DataGrid control. This PR introduces a new resource DataGridColumnHeaderForeground color which is now used as the color of the column header text.
Customer Impact
Customers using Desert mode won't be able to see the column headers correctly.
Regression
Yes. Introduced in .NET 10 Preview 5 / 6.
Testing
Local app testing.
Risk
Minimal
Microsoft Reviewers: Open in CodeFlow