WinUI コントロール
メニューの開き
コントロール > Menu > メニューの開き

By default, the menu and the submenus close when a user clicks outside of the menu. However, you can change this behavior by disabling the automatic closing feature, which allows to keep menus open even when the user clicks outside the menu control's boundaries. To turn off the automatic closing, you need to set the AutoClose property to False.

The following GIFs display the default behavior, i.e., automatic closing of menu when the user clicks outside of the menu and the behavior of menu when the AutoClose property is set to False explicitly.

Automatic Closing(Default Behavior) Without Automatic Closing
Menu auto closing behavior Menu without auto closing behavior

To disable automatic closing of the menu when the user clicks outside of it, use the following code:

XAML
コードのコピー
<c1:C1Menu x:Name="WordMenu" AutoClose="False" Orientation="Horizontal" VerticalAlignment="Top"></c1:C1Menu>