共用方式為


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

範例

下列範例會CanExecuteRoutedEventHandlerExecutedRoutedEventHandler卸離 先前附加至 Button的 和 。

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

適用於

另請參閱