fix: ComboBox dropdown auto-closes when inside Menu control#1807
Open
DineshSolanki wants to merge 1 commit into
Open
fix: ComboBox dropdown auto-closes when inside Menu control#1807DineshSolanki wants to merge 1 commit into
DineshSolanki wants to merge 1 commit into
Conversation
Add mouse capture to ToggleBlock.OnMouseDown to prevent WPF's Menu PopupControlService from closing the parent popup on mouse-up. Without capture, the Menu sees the mouse-up event and closes the hosting MenuItem popup, which cascades to close the ComboBox dropdown. Fixes HandyOrg#1467
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.
Problem
ComboBox dropdown auto-closes immediately when placed inside a
control. The dropdown opens on mouse-down but closes on mouse-up before the user can make a selection.Reproduction:
Introduced in: 8e707a6 ("enhance: optimize input elements") — which replaced the standard WPF ToggleButton (with ClickMode="Press" and built-in mouse capture) with a custom ToggleBlock control that lacked mouse capture.
Root Cause
WPF's Menu control uses PopupControlService to track mouse events and manage popup lifecycles. When the user clicks the ComboBox inside a Menu:
Fix
Add mouse capture to ToggleBlock.OnMouseDown to prevent WPF's Menu PopupControlService from closing the parent popup on mouse-up. Without capture, the Menu sees the mouse-up event and closes the hosting MenuItem popup, which cascades to close the ComboBox dropdown.
Fixes #1467