Skip to content

Hide the SortGlyphColor property of DataGridViewCellStyle - #15092

Open
LeafShi1 wants to merge 2 commits into
dotnet:mainfrom
LeafShi1:Fix_15091_hidden_SortGlyphColor_item
Open

LeafShi1 wants to merge 2 commits into
dotnet:mainfrom
LeafShi1:Fix_15091_hidden_SortGlyphColor_item

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Sep 14, 2026

Copy link
Copy Markdown
Member

Fixes #15091

Root Cause

The sort icon is not serializable, but it has not been hidden.

Proposed changes

  • Hide the SortGlyphColor property of DataGridViewCellStyle

Customer Impact

  • This property “SortGlyphColor ” will not be displayed on the user settings page

Regression?

  • Yes

Risk

  • Minimal

Screenshots

Before

Failed setting the color for the SortGlyphColor item in the CellStyle Builder page of RowsDefaultCellStyle property for DataGridView Control

Image Image

After

This property is hidden and does not accept user customization.

image

Test methodology

  • Manually

Test environment(s)

  • .net 12.0.0-beta.26461.114
Microsoft Reviewers: Open in CodeFlow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Add a regression test verifying that SortGlyphColor is not browsable.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Hides DataGridViewCellStyle.SortGlyphColor from the CellStyle Builder to prevent invalid customization.

Changes:

  • Adds [Browsable(false)] to SortGlyphColor.
File summaries
File Summary
src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridViewCellStyle.cs Hides SortGlyphColor; a focused TypeDescriptor regression test is still required.
Review details

Suppressed comments (1)

src/System.Windows.Forms/System/Windows/Forms/Controls/DataGridView/DataGridViewCellStyle.cs:342

  • Browsable(false) removes this member from the CellStyle Builder, but it does not exclude it from designer serialization. DataGridViewCellStyle still has ShouldSerializeSortGlyphColor(), and the serializer skips properties only when they have DesignerSerializationVisibility.Hidden; a non-empty value set programmatically or loaded from an existing style can therefore still produce SortGlyphColor = ... in generated code and reproduce the reported compile failure. Add the hidden serialization metadata as well, like Tag below.
    [Browsable(false)]
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.24166%. Comparing base (60135a0) to head (a3c1855).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@              Coverage Diff              @@
##                main      #15092   +/-   ##
=============================================
  Coverage   37.24166%   37.24166%           
=============================================
  Files            246         246           
  Lines           9774        9774           
  Branches        1029        1029           
=============================================
  Hits            3640        3640           
  Misses          5970        5970           
  Partials         164         164           
Flag Coverage Δ
Debug 37.24166% <ø> (ø)
production 39.36526% <ø> (ø)
test 20.64923% <ø> (ø)
unit 39.36526% <ø> (ø)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed setting the color value for the SortGlyphColor item in the CellStyle Builder page of RowsDefaultCellStyle property for DataGridView control

2 participants