CommandManager.RemovePreviewCanExecuteHandler 方法

定义

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

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

参数

element
UIElement

要从中移除 handler 的元素。

handler
CanExecuteRoutedEventHandler

可以执行的处理程序。

例外

elementhandlernull

示例

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

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

适用于

另请参阅