Consider the following XAML:
<Window x:Class="ContextMenuEvent.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" ContextMenuOpening="Window_ContextMenuOpening">
<Grid>
<Button>Ok</Button>
</Grid>
</Window>
When you right-click the ContextMenuOpening button is launched, even if the context menu does not appear.
Why is this happening? What can I do to get at least once when the context menu REALLY opens?
I know that I can use the ContextMenu.Opened event, but this will cover only one context menu, and I want to cover all the (existing) context menus in the form.
source
share