Skip to content

Hide the VisualStylesModeChanged event of the PropertyGrid - #14814

Merged
LeafShi1 merged 1 commit into
dotnet:mainfrom
LeafShi1:Fix_14803_hide_VisualStylesModeChanged_PropertyGrid
Jul 28, 2026
Merged

LeafShi1 merged 1 commit into
dotnet:mainfrom
LeafShi1:Fix_14803_hide_VisualStylesModeChanged_PropertyGrid

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #14803

Root Cause

The VisualStylesMode property has been explicitly hidden in PropertyGrid (using attributes such as [Browsable(false)]), yet the corresponding VisualStylesModeChanged event remains visible in the designer's events window.

Proposed changes

  • Added a hidden VisualStylesModeChanged event declaration in PropertyGrid.cs, consistent with the already hidden VisualStylesMode property.

Customer Impact

  • Developers will not see the unavailable VisualStylesModeChanged event in the Events window when using the PropertyGrid

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

PropertyGrid hides the VisualStylesMode property, but the corresponding VisualStylesModeChanged event is still exposed in the Events window.

Image

After

VisualStylesModeChanged event is hidden in the Events window

image

Test methodology

  • Manually

Test environment(s)

  • .net 11.0.0-preview.7.26365.101
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.

Pull request overview

This pull request addresses a design-time consistency issue in PropertyGrid by hiding the VisualStylesModeChanged event, matching the existing hidden VisualStylesMode property, so the event no longer appears in the Designer’s Events window.

Changes:

  • Added a new VisualStylesModeChanged event on PropertyGrid annotated with [Browsable(false)] and [EditorBrowsable(Never)] to hide it from design-time surfaces.
  • Updated PublicAPI.Unshipped.txt to reflect the newly declared PropertyGrid.VisualStylesModeChanged member.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.cs Adds a shadowing event declaration with hidden design-time metadata attributes.
src/System.Windows.Forms/PublicAPI.Unshipped.txt Records the newly declared PropertyGrid.VisualStylesModeChanged event in the unshipped API list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SimonZhao888

Copy link
Copy Markdown
Member

Looks good to me!

@KlausLoeffelmann KlausLoeffelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good to go!

@LeafShi1
LeafShi1 merged commit bab083a into dotnet:main Jul 28, 2026
10 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 28, 2026
SimonZhao888 pushed a commit to SimonZhao888/v-weidzh-winforms that referenced this pull request Aug 5, 2026
)

## Root Cause

The `VisualStylesMode` property has been explicitly hidden in `PropertyGrid` (using attributes such as `[Browsable(false)]`), yet the corresponding `VisualStylesModeChanged` event remains visible in the designer's events window.


## Proposed changes

-  Added a hidden `VisualStylesModeChanged` event declaration in `PropertyGrid.cs`, consistent with the already hidden `VisualStylesMode` property.

<!-- We are in TELL-MODE the following section must be completed -->

## Customer Impact

- Developers will not see the unavailable `VisualStylesModeChanged` event in the Events window when using the `PropertyGrid`
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PropertyGrid exposes VisualStylesModeChanged event although VisualStylesMode is hidden

4 participants