ContextMenu.Closed ContextMenu.Closed ContextMenu.Closed ContextMenu.Closed Event

定义

ContextMenu 的特定实例关闭时发生。Occurs when a particular instance of a ContextMenu closes.

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

示例

下面的示例演示如何使用ContextMenu事件: OpenedClosedThe following example shows how use the ContextMenu events: Opened and Closed.

<ContextMenu Name="cm" Opened="OnOpened" Closed="OnClosed" StaysOpen="true">
void OnOpened(object sender, RoutedEventArgs e)
{
    cmButton.Content = "The ContextMenu Opened";
}
void OnClosed(object sender, RoutedEventArgs e)
{
    cmButton.Content = "The ContextMenu Closed";
}
Private Sub OnOpened(ByVal sender As Object, ByVal args As RoutedEventArgs)
    cmButton.Content = "The ContextMenu Opened"
End Sub

Private Sub OnClosed(ByVal sender As Object, ByVal args As RoutedEventArgs)
    cmButton.Content = "The ContextMenu Closed"
End Sub

注解

路由事件信息Routed Event Information

标识符字段Identifier field ClosedEvent
路由策略Routing strategy 冒泡Bubbling
委托Delegate RoutedEventHandler

适用于

另请参阅