War diese Seite hilfreich?
Ihr Feedback ist uns wichtig. Teilen Sie uns Ihre Meinung mit.
Weiteres Feedback?
1500 verbleibende Zeichen
Collapse the table of content
Expand the table of content


Represents the method that will handle the CanExecute event.

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

public delegate void CanExecuteRoutedEventHandler (
	Object sender,
	CanExecuteRoutedEventArgs e
/** @delegate */
public delegate void CanExecuteRoutedEventHandler (
	Object sender, 
	CanExecuteRoutedEventArgs e
In XAML können Sie Delegaten verwenden, jedoch keine eigenen definieren.



The source of the event.


The event data.

The CanExecuteRoutedEventHandler determines if the command associated with the event is able to execute on the command target. The command target is either the target set by the ICommandSource or, if the CommandTarget is not set, the element with keyboard focus. If it is determined that the command can execute on the target, then CanExecute should be set to true; otherwise, set it to false.

When you create a CanExecuteRoutedEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Ereignisse und Delegaten.

The following shows a CanExecuteRoutedEventHandler which sets CanExecute to true.

void OpenCmdCanExecute(object sender, CanExecuteRoutedEventArgs e)
    e.CanExecute = true;

Microsoft .NET Framework 3.0 wird unter Windows Vista, Microsoft Windows XP SP2 und Windows Server 2003 SP1 unterstützt.

.NET Framework

Unterstützt in: 3.0
© 2015 Microsoft