Fix PropertyGrid Tab navigation regression caused by ToolStrip keyboard focus changes#14434
Open
LeafShi1 wants to merge 3 commits intodotnet:mainfrom
Open
Fix PropertyGrid Tab navigation regression caused by ToolStrip keyboard focus changes#14434LeafShi1 wants to merge 3 commits intodotnet:mainfrom
LeafShi1 wants to merge 3 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a WinForms PropertyGrid Tab navigation regression introduced by global ToolStrip “active ToolStrip / menu mode” focus handling changes, by preventing the inner PropertyGridToolStrip from remaining active in ToolStripManager.ModalMenuFilter when it receives focus.
Changes:
- Override
PropertyGridToolStrip.WndProcto detectWM_SETFOCUSand remove the inner ToolStrip fromModalMenuFilter’s active ToolStrip queue. - Exit menu mode when the
PropertyGridToolStripwas the active ToolStrip and no other active ToolStrip remains.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGridToolStrip.cs
Outdated
Show resolved
Hide resolved
Removed reference to global ToolStrip menu mode handling in comment.
SimonZhao888
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14421
Root cause
ToolStripso that whenever aToolStripreceives focus (WM_SETFOCUS), it becomes the active ToolStrip inToolStripManager.ModalMenuFilter.PropertyGridToolStripit means:PropertyGridtoolbar.PropertyGridon the form, this extra menu-mode/ActiveToolStrip state causes the second and subsequent Tab cycles to be biased toward the PropertyGrid and its toolbar, so some sibling controls (e.g. Button, ComboBox) are skipped — a regression vs .NET Framework and .NET 8/9.Proposed changes
PropertyGridToolStrip(the inner ToolStrip used by PropertyGrid), overrideWndProcand, onWM_SETFOCUS, remove this ToolStrip fromToolStripManager.ModalMenuFilter’sactive ToolStrip list and exit menu mode if it was the active one.Customer Impact
Regression?
Risk
Screenshots
Before
PropertyGridIssue.mp4
After
All TabStop controls (Buttons, PropertyGrid, etc.) are visited in order on every Tab cycle
AfterChanges.mp4
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow