RemovePreviewCanExecuteHandler Method

CommandManager.RemovePreviewCanExecuteHandler Method (UIElement, CanExecuteRoutedEventHandler)

 

Detaches the specified CanExecuteRoutedEventHandler from the specified element.

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public static void RemovePreviewCanExecuteHandler(
	UIElement element,
	CanExecuteRoutedEventHandler handler
)

Parameters

element
Type: System.Windows.UIElement

The element to remove handler from.

handler
Type: System.Windows.Input.CanExecuteRoutedEventHandler

The can execute handler.

Exception Condition
ArgumentNullException

element or handler is null.

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);

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft