Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CommandManager.RemovePreviewCanExecuteHandler Method

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.

ExceptionCondition
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

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft