-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Fluent] Adds missing style for GridView in WPF #10909
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 adds comprehensive GridView styling to the Fluent WPF themes so that developers can use the GridView mode of the ListView control with a modern fluent look. Key changes include:
- Adding new resource definitions and control templates for GridViewColumnHeader and GridView scroll viewer in multiple theme files (Fluent.xaml, Fluent.Light.xaml, Fluent.HC.xaml, Fluent.Dark.xaml).
- Introducing a new converter (ViewIsGridViewConverter) for switching between GridView and ListView templates.
- Updating existing ListView and ListViewItem styles to support GridView mode.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
Themes/Fluent.xaml | Replaced ItemsHost StackPanel with an ItemsPresenter and added GridView styles and triggers. |
Themes/Fluent.Light.xaml, Fluent.HC.xaml, Fluent.Dark.xaml | Added GridView-related resource keys and style definitions for visual consistency in light, high contrast, and dark modes. |
Styles/ListView.xaml & ListViewItem.xaml | Modified ListView and ListViewItem styles to incorporate GridView templates via DataTriggers. |
Styles/GridView.xaml | Introduced a new resource dictionary containing the core GridView style definitions. |
PresentationFramework.Fluent.csproj & Controls\ViewIsGridViewConverter.cs | Added support for the new GridView converter used in template switching. |
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.xaml:2440
- [nitpick] There is a TODO comment in the GridView floating header template. If this functionality is intentionally deferred, consider adding additional context or linking to a tracking issue so that future maintainers understand the plan.
<!-- TODO : Verify / Check these values -->
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10909 +/- ##
=================================================
- Coverage 2.98814% 2.98812% -0.00003%
=================================================
Files 3319 3320 +1
Lines 664895 664900 +5
Branches 74675 74675
=================================================
Hits 19868 19868
- Misses 644846 644851 +5
Partials 181 181
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Glad to see these coming in. The styling looks nice too.
|
...osoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Controls/ViewIsGridViewConverter.cs
Show resolved
Hide resolved
Initially I was of the same opinion to have the background for grid view header similar to what is present in datagrid, but then I stumbled upon the data table from community toolkit which is essentially the same thing. |
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/GridView.xaml
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/GridView.xaml
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/GridView.xaml
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ListView.xaml
Show resolved
Hide resolved
5257770
to
b4ff4f0
Compare
Fixes #10775
Description
This PR adds the style for to correctly display GridView in WPF when using the new Fluent styles. The styles have been aimed to mirror the DataTable style from Windows Community Toolkit.
Here are the screenshots of how the GridView in WPF will look like in different modes :
GridView in Light and Dark Mode. Shows item normal, hover and selected state styles

GridView ColumnHeader Hover state

GridView Column Reordering State
GridView in HighContrast mode

Customer Impact
Developers using the Fluent styles in WPF will now be unblocked and will be able to use GridView mode of the ListView control.
Regression
No
Testing
Local testing with sample app
Risk
Minimal. Adds new functionality.
Microsoft Reviewers: Open in CodeFlow