Skip to content

DarkMode (f) Fix ListView ColumnHeaders theme change #13473

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

Open
wants to merge 1 commit into
base: klaus/preview5/E
Choose a base branch
from

Conversation

KlausLoeffelmann
Copy link
Member

@KlausLoeffelmann KlausLoeffelmann commented May 17, 2025

This PR fixes a bug, where the ListView does not apply dark mode to the ColumnHeaders, if the View changes after the ListView Handel has been created.

This fixes #13472.

Microsoft Reviewers: Open in CodeFlow

@KlausLoeffelmann KlausLoeffelmann added this to the 10 Preview5 milestone May 17, 2025
@KlausLoeffelmann KlausLoeffelmann self-assigned this May 17, 2025
@KlausLoeffelmann KlausLoeffelmann requested a review from a team as a code owner May 17, 2025 20:06
@KlausLoeffelmann KlausLoeffelmann added the area-DarkMode Issues relating to Dark Mode feature label May 17, 2025
Copy link

@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 aims to fix dark mode theming for ListView column headers when the view changes after the handle is created, alongside introducing a new FormScreenCaptureMode API with corresponding resource and public API updates.

  • Added a new BannerContainerThemeIdentifier constant for ListView header theming
  • Introduced resource entries and public API registrations for FormScreenCaptureMode
  • Updated native methods, solution file, and added AI-Prompts projects

Reviewed Changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/System.Windows.Forms/System/Windows/Forms/Control.cs Added BannerContainerThemeIdentifier constant for banner theming
src/System.Windows.Forms/Resources/xlf/*.xlf Inserted FormScreenCaptureModeDescr translation units (placeholders)
src/System.Windows.Forms/Resources/SR.resx Added resource entry for FormScreenCaptureModeDescr
src/System.Windows.Forms/PublicAPI.Unshipped.txt Registered new FormScreenCaptureMode and related enums/events
src/System.Windows.Forms/PublicAPI.Shipped.txt Removed outdated FormCornerPreference events from shipped API
src/System.Windows.Forms.Primitives/src/NativeMethods.txt Added GetWindowDisplayAffinity and SetWindowDisplayAffinity entries
Winforms.sln Added AI-Prompts and GDI solution items (seem unrelated to dark mode)
.github/AI-Prompts/GDI-Refactoring/AIP-cache_pens-and_brushes.md New AI-Prompts doc added
Comments suppressed due to low confidence (2)

src/System.Windows.Forms/PublicAPI.Unshipped.txt:1

  • These public API additions for screen capture mode are unrelated to the dark mode theming fix. Consider isolating them into a separate PR to keep changes focused.
System.Windows.Forms.Form.FormScreenCaptureMode.get -> System.Windows.Forms.ScreenCaptureMode

Winforms.sln:212

  • The addition of the AI-Prompts and GDI solution items appears unrelated to the dark mode bug. These should be moved to a dedicated PR to avoid mixing concerns.
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AI-Prompts", "AI-Prompts", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"

@@ -162,6 +162,7 @@ public unsafe partial class Control :
internal const string ExplorerThemeIdentifier = "Explorer";
internal const string ItemsViewThemeIdentifier = "ItemsView";
internal const string ComboBoxButtonThemeIdentifier = "CFD";
Copy link
Preview

Copilot AI May 17, 2025

Choose a reason for hiding this comment

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

Consider adding an XML doc comment above this constant to explain its purpose and where it is applied in theming.

Suggested change
internal const string ComboBoxButtonThemeIdentifier = "CFD";
internal const string ComboBoxButtonThemeIdentifier = "CFD";
/// <summary>
/// Identifier for the theme applied to the banner container in File Explorer.
/// This is used to ensure consistent theming for banner containers across the application.
/// </summary>

Copilot uses AI. Check for mistakes.

@@ -5620,6 +5620,11 @@ Do you want to replace it?</source>
<target state="translated">此表單的擁有人。</target>
<note />
</trans-unit>
<trans-unit id="FormScreenCaptureModeDescr">
<source>Gets or sets the behavior for preventing screen capture/video recording of the form's content via screen capture applications based on the Windows APIs.</source>
<target state="new">Gets or sets the behavior for preventing screen capture/video recording of the form's content via screen capture applications based on the Windows APIs.</target>
Copy link
Preview

Copilot AI May 17, 2025

Choose a reason for hiding this comment

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

The new translation unit FormScreenCaptureModeDescr uses the English text as its target. Please provide proper localized translations for this entry.

Suggested change
<target state="new">Gets or sets the behavior for preventing screen capture/video recording of the form's content via screen capture applications based on the Windows APIs.</target>
<target state="translated">取得或設定行為,以防止透過基於 Windows API 的螢幕擷取應用程式擷取或錄製表單內容。</target>

Copilot uses AI. Check for mistakes.

@KlausLoeffelmann KlausLoeffelmann changed the base branch from main to klaus/preview5/E May 17, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DarkMode Issues relating to Dark Mode feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ListView details view ColumnsHeaders in DarkMode remain light mode in certain conditions
1 participant