CommandManager.RemoveExecutedHandler 方法

定义

从指定的元素分离指定的 ExecutedRoutedEventHandler

public:
 static void RemoveExecutedHandler(System::Windows::UIElement ^ element, System::Windows::Input::ExecutedRoutedEventHandler ^ handler);
public static void RemoveExecutedHandler (System.Windows.UIElement element, System.Windows.Input.ExecutedRoutedEventHandler handler);
static member RemoveExecutedHandler : System.Windows.UIElement * System.Windows.Input.ExecutedRoutedEventHandler -> unit
Public Shared Sub RemoveExecutedHandler (element As UIElement, handler As ExecutedRoutedEventHandler)

参数

element
UIElement

要从中移除 handler 的元素。

handler
ExecutedRoutedEventHandler

执行的处理程序。

例外

elementhandlernull

示例

以下示例分离CanExecuteRoutedEventHandler之前已附加到 的 和 ExecutedRoutedEventHandlerButton

CommandManager.RemoveExecutedHandler(helpButton, HelpCmdExecuted);
CommandManager.RemoveCanExecuteHandler(helpButton, HelpCmdCanExecute);
CommandManager.RemoveExecutedHandler(helpButton, AddressOf HelpCmdExecuted)
CommandManager.RemoveCanExecuteHandler(helpButton, AddressOf HelpCmdCanExecute)

适用于

另请参阅