共用方式為


CommandManager.RemoveCanExecuteHandler 方法

定義

將指定的 CanExecuteRoutedEventHandler 從指定的項目中斷連結。

public:
 static void RemoveCanExecuteHandler(System::Windows::UIElement ^ element, System::Windows::Input::CanExecuteRoutedEventHandler ^ handler);
public static void RemoveCanExecuteHandler (System.Windows.UIElement element, System.Windows.Input.CanExecuteRoutedEventHandler handler);
static member RemoveCanExecuteHandler : System.Windows.UIElement * System.Windows.Input.CanExecuteRoutedEventHandler -> unit
Public Shared Sub RemoveCanExecuteHandler (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)

適用於

另請參閱