共用方式為


ContextMenu.Closed 事件

定義

發生於 ContextMenu 的特定執行個體關閉時。

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 事件: OpenedClosed

<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

備註

路由事件資訊

識別碼欄位 ClosedEvent
路由策略 鼓 泡
代理人 RoutedEventHandler

適用於

另請參閱