CmdPal: Fix dock popup XamlRoot handling on DockControl#46305
Merged
Conversation
- Registers message handlers in DockControl only while controls are loaded. - Guards the edit-mode TeachingTip until the dock is rooted. - Sets XamlRoot for dock flyouts and tooltips before showing. - Ensures that tooltips in DockItemControl are set only after XamlRoot is explicitly set. - Unregisteres messages and CenterItems_CollectionChanged when unloaded.
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses CmdPal dock crashes caused by attempting to show unparented popups (ToolTips/Flyouts/TeachingTip) before a valid XamlRoot is available, aligning popup creation/show timing with WinUI’s XamlRoot requirements.
Changes:
- Delay/register/unregister
WeakReferenceMessengerhandlers andCenterItems.CollectionChangedonly whileDockControlis loaded; proactively close open popups on unload. - Guard edit-mode
TeachingTipopening until the dock is rooted (XamlRootavailable). - Ensure dock flyouts and dock item tooltips have
XamlRootset before showing/attaching.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockControl.xaml.cs |
Moves message/event subscriptions to Loaded/Unloaded, gates edit-mode TeachingTip, and sets XamlRoot on flyouts before ShowAt/ShowAt(button). |
src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockItemControl.xaml.cs |
Defers tooltip popup creation until XamlRoot is available and explicitly sets ToolTip.XamlRoot before attaching. |
zadjii-msft
approved these changes
Mar 20, 2026
zateutsch
approved these changes
Mar 24, 2026
zateutsch
added a commit
that referenced
this pull request
Mar 25, 2026
Cherry-picked commits: - Make KBM Editor pinnable (#46482) - CmdPal: Fix missing primary context command for late-bound items (#46131) - CmdPal: Ensure DockWindow property cleans up after itself (#46303) - CmdPal: Hotfix commonCallbacks array initial count to prevent negative number (#46215) - CmdPal: Fix missing app context menu actions on the main page (#46293) - CmdPal: Fix dock popup XamlRoot handling on DockControl (#46305) - CmdPal: Reduce DockWindow backdrop switching and visual artifacts (#46309) - Always On Top: The opacity should be able to configure the hotkey individually (#46410) - [OOBE] Ensure the Settings button on the SCOOBE page opens Home, not a blank page (#46203) - CmdPal: Fix scroller scrolling and down glyph (#46447) - [Settings] Decouple Settings.UI.Library from PowerDisplay.Lib to fix (#46325)
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.
Summary of the Pull Request
This PR handles situations when app can crash because a popup control is being touched before XamlRoot is set.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed