8000 [Fluent] Adds missing style for GridView in WPF by dipeshmsft · Pull Request #10909 · dotnet/wpf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[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

Merged
merged 5 commits into from
Jun 4, 2025

Conversation

dipeshmsft
Copy link
Member
@dipeshmsft dipeshmsft commented Jun 3, 2025

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.

image

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
image

GridView ColumnHeader Hover state
image

GridView Column Reordering State

  • Floating gripper i.e. blue color rectangle, is still Aero2 styled and will be fixed in a subsequent PR.
    image

GridView in HighContrast mode
image

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

@Copilot Copilot AI review requested due to automatic review settings June 3, 2025 09:17
@dipeshmsft dipeshmsft requested a review from a team as a code owner June 3, 2025 09:17
@dipeshmsft dipeshmsft added this to the 10.0.0 milestone Jun 3, 2025
@dotnet-policy-service dotnet-policy-service bot added the PR metadata: Label to tag PRs, to facilitate with triage label Jun 3, 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 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 -->

Copy link
codecov bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 2.98812%. Comparing base (33f4f80) to head (b4ff4f0).
Report is 1 commits behind head on main.

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                 
Flag Coverage Δ
Debug 2.98812% <0.00000%> (-0.00003%) ⬇️

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.

@robert-abeo
Copy link
robert-abeo commented Jun 3, 2025

Glad to see these coming in. The styling looks nice too.

@dipeshmsft
Copy link
Member Author

I probably would style the header with a background by default similar to the DataGrid style

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.

@dotnet-policy-service dotnet-policy-service bot added 📭 waiting-author-feedback To request more information from author. and removed 📭 waiting-author-feedback To request more information from author. labels Jun 4, 2025
@dipeshmsft dipeshmsft force-pushed the fluent/style-fix/gridview-support branch from 5257770 to b4ff4f0 Compare June 4, 2025 09:40
@dipeshmsft dipeshmsft merged commit 3439f20 into main Jun 4, 2025
8 checks passed
@dipeshmsft dipeshmsft deleted the fluent/style-fix/gridview-support branch June 4, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR metadata: Label to tag PRs, to facilitate with triage Win 11 Theming
Projects
Status: ☑ Done
Development

Successfully merging this pull request may close these issues.

[ Fluent ] Add missing style for GridView
4 participants
0