Fix Popup/ContextMenu flicker caused by repositioning a fading out root#11735
Open
h3xds1nz wants to merge 1 commit into
Open
Fix Popup/ContextMenu flicker caused by repositioning a fading out root#11735h3xds1nz wants to merge 1 commit into
h3xds1nz wants to merge 1 commit into
Conversation
amarinov-msft
approved these changes
Jun 28, 2026
Contributor
|
Why does it not affect other animations? |
Member
Author
|
Other animations are performed only on show, not on hide. Other animations hide the window (via |
miloush
approved these changes
Jul 3, 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 #11741
Description
When you have an app without PMA enabled (still common nowadays) and define a
ContextMenuthat usesFadeanimation (the system default), upon attempting to reopen theContextMenuat a different location in succession, you will observe flicker upon repositioning. This has been issue since early NETFX days, difference being that nowadays a PMA-enabled app will not observe it anymore as the window is not reused but a new one is always created due to other issues within WPF but also DWM.This is caused by the fact that the window is reused and interrupted midst an ongoing fade-out animation, together with a call to
SetWindowPoscausing a repositioning, resulting in an ugly flicker.There are two ways to fix this:
Menufor no reason, potentially breaking user expectations.Fadeanimation.Customer Impact
Customers will finally get their fix after 15 years / won't need to disable animations.
syncfusion/wpf-demos#23 (see video if you don't know what its about)
https://www.reddit.com/r/csharp/comments/1l8mb9o/wpf_contextmenu_flickering_issue/
https://stackoverflow.com/questions/13553456/contextmenu-of-tabcontrol-blinks-when-opened-a-second-time
Regression
No, this has been issue pretty much since the dark days.
Testing
Few years of user-facing commercial apps.
Risk
Shouldn't cause any issues, this is a path that's hit regularly with PMA-enabled apps already.
Microsoft Reviewers: Open in CodeFlow