MenuItem.SubmenuOpened 事件

定义

IsSubmenuOpen 属性的状态更改为 true 时发生。

public:
 event System::Windows::RoutedEventHandler ^ SubmenuOpened;
public event System.Windows.RoutedEventHandler SubmenuOpened;
member this.SubmenuOpened : System.Windows.RoutedEventHandler 
Public Custom Event SubmenuOpened As RoutedEventHandler 

事件类型

示例

以下示例演示如何调用和处理 SubmenuOpened 事件。

<MenuItem Name="submenu" Header="Menu with Submenu" 
          SubmenuOpened="OnSubmenuOpened"
          SubmenuClosed="OnSubmenuClosed">
private void OnSubmenuOpened(object sender, RoutedEventArgs e)
{

    if (sender == e.Source)
    {
        textBlock1.Text = "Submenu is open.";
    }
}
Private Sub OnSubmenuOpened(ByVal sender As Object, ByVal e As RoutedEventArgs)

    If sender Is e.Source Then
        textBlock1.Text = "Submenu is open."
    End If
End Sub

注解

路由事件信息

标识符字段 SubmenuOpenedEvent
路由策略 鼓 泡
委托 RoutedEventHandler

适用于