Open TomEdwardsEnscape opened 2 years ago
This is an issue with ContextMenu
s and Flyout
s specifically, because they create a Popup
that isn't hosted in the visual tree.
I think the solution to this should be simple: if the Popup
has no visual parent, use the logical parent as the interactive parent, i.e. override IInteractive.InteractiveParent
in Popup
.
Describe the bug The
PopupRoot
class is explicitly designed to passRoutedEvents
to its parent window.It does not do so, because its parent is not a window but a
Popup
object.Popup.InteractiveParent
returns the value ofPopup.VisualParent
, which is alwaysnull
.To Reproduce Create a window with this XAML:
And this C#:
Follow the on-screen instructions and you will see this debug output:
The menu click is not detected on the window.
Expected behavior Events should be forwarded from the context menu to its parent window. In the case of the window above, this debug output should be produced after clicking on the menu item:
Desktop (please complete the following information):