แก้ไข

แชร์ผ่าน


CommandManager.RemoveCanExecuteHandler Method

Definition

Detaches the specified CanExecuteRoutedEventHandler from the specified element.

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)

Parameters

element
UIElement

The element to remove handler from.

handler
CanExecuteRoutedEventHandler

The can execute handler.

Exceptions

element or handler is null.

Examples

The following example detaches a CanExecuteRoutedEventHandler and an ExecutedRoutedEventHandler which had previously been attached to a Button.

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

Applies to

See also