Skip to content
HO-COOH edited this page Mar 22, 2026 · 2 revisions

WindowContextMenu

Properties (WinUI3 IDL)

Name IsDependencyProperty Description
Menu Microsoft.UI.Xaml.Controls.MenuFlyout property.
Window Microsoft.UI.Xaml.Window property.

A customized version of ModernStandardWindowContextMenu that allows you to use a custom MenuFlyout with any items you'd like. Usage are largely the same to ModernStandardWindowContextMenu, that you still bind a Window with {x:Bind}, but you do not need to add a resource to Application.Resources

<Window ...>
    <StackPanel>
        <StackPanel.Resources>
            <essential:WindowContextMenu x:Name="Menu" Window="{x:Bind}">
                <MenuFlyout>
                    <MenuFlyoutItem Text="Item1" />
                    <MenuFlyoutItem Text="Item2" />
                </MenuFlyout>
            </essential:WindowContextMenu>
        </StackPanel.Resources>
    </StackPanel>
</Window>

Clone this wiki locally