ExecutedRoutedEventArgs 类

定义

ExecutedPreviewExecuted 路由事件提供数据。Provides data for the Executed and PreviewExecuted routed events.

public ref class ExecutedRoutedEventArgs sealed : System::Windows::RoutedEventArgs
public sealed class ExecutedRoutedEventArgs : System.Windows.RoutedEventArgs
type ExecutedRoutedEventArgs = class
    inherit RoutedEventArgs
Public NotInheritable Class ExecutedRoutedEventArgs
Inherits RoutedEventArgs
继承
ExecutedRoutedEventArgs

示例

下面的示例创建一个 ExecutedRoutedEventHandler ,它将 MessageBox 在执行命令时打开。The following example creates an ExecutedRoutedEventHandler that opens a MessageBox when the command is executed.

void OpenCmdExecuted(object target, ExecutedRoutedEventArgs e)
{
    String command, targetobj;
    command = ((RoutedCommand)e.Command).Name;
    targetobj = ((FrameworkElement)target).Name;
    MessageBox.Show("The " + command +  " command has been invoked on target object " + targetobj);
}
Private Sub OpenCmdExecuted(ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
    Dim command, targetobj As String
    command = CType(e.Command, RoutedCommand).Name
    targetobj = CType(sender, FrameworkElement).Name
    MessageBox.Show("The " + command + " command has been invoked on target object " + targetobj)
End Sub

注解

ExecutedRoutedEventHandler 表示实现的命令逻辑的方法 RoutedCommandExecutedRoutedEventHandler represents the method that implements the command logic of a RoutedCommand. 通过从命令分离实现逻辑,可从不同的源和类型调用命令并实现命令逻辑的集中。Separating the implementation logic from the command allows the command to be invoked from different sources and types and enables the centralization of command logic.

此事件数据类还用于 CommandManager.ExecutedCommandManager.PreviewExecutedThis event data class is also used for CommandManager.Executed and CommandManager.PreviewExecuted. 但大多数实际处理程序将处理 Executed 来自特定的事件 CommandBinding ,而不是在 CommandManager 级别工作。But most practical handlers will handle the Executed events from a particular CommandBinding, rather than work at the CommandManager level.

有关命令的详细信息,请参阅命令概述For more information on commanding, see Commanding Overview.

属性

Command

获取调用过的命令。Gets the command that was invoked.

Handled

获取或设置一个值,该值指示针对路由事件(在其经过路由时)的事件处理的当前状态。Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.

(继承自 RoutedEventArgs)
OriginalSource

在父类进行任何可能的 Source 调整之前,获取由纯命中测试确定的原始报告源。Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.

(继承自 RoutedEventArgs)
Parameter

获取命令的数据参数。Gets data parameter of the command.

RoutedEvent

获取或设置与此 RoutedEventArgs 实例关联的 RoutedEventGets or sets the RoutedEvent associated with this RoutedEventArgs instance.

(继承自 RoutedEventArgs)
Source

获取或设置对引发事件的对象的引用。Gets or sets a reference to the object that raised the event.

(继承自 RoutedEventArgs)

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InvokeEventHandler(Delegate, Object)

当在派生类中重写时,提供特定于类型的调用事件处理程序的方式,该方式与基实现相比可提高效率。When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation.

(继承自 RoutedEventArgs)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnSetSource(Object)

在派生类中重写时,每当实例的 Source 属性的值发生更改,则提供一个通知回调入口点。When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes.

(继承自 RoutedEventArgs)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅