RoutedEvent Class


表示和标识路由事件,并声明其特征。Represents and identifies a routed event and declares its characteristics.

public ref class RoutedEvent sealed
[System.ComponentModel.TypeConverter("System.Windows.Markup.RoutedEventConverter, PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public sealed class RoutedEvent
[System.ComponentModel.TypeConverter("System.Windows.Markup.RoutedEventConverter, PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public sealed class RoutedEvent
type RoutedEvent = class
Public NotInheritable Class RoutedEvent


此类包含 NameRoutingStrategyHandlerTypeOwnerType 属性。This class contains the Name, RoutingStrategy, HandlerType, and OwnerType properties. 这些成员都不能具有 null 值。None of these members can have null values.

此类具有 XAML 用法,专门用于提供 EventTrigger (或派生类)的 RoutedEvent 属性的值,或用于 EventSetter (或派生类)的 Event 属性的值。This class has a XAML usage that is exclusively intended for providing the value of the RoutedEvent property of an EventTrigger (or derived class), or for the Event property of an EventSetter (or derived class). 有关这些类的 EventTriggerEventSetter和 XAML 用法的详细信息,请参阅路由事件概述For more information about EventTrigger, EventSetter, and the XAML usages for those classes, see Routed Events Overview.

XAML 特性用法XAML Attribute Usage

<object property="eventName"/>  

- 或 --or-

<object property="type.eventName"/>  


一个非限定的事件名称,它等效于 RoutedEvent 字段的 Name 属性,而不是类型中 RoutedEvent 标识符字段的实际成员名称。An unqualified event name, equivalent to the Name property of the RoutedEvent field, not the actual member name of the RoutedEvent identifier field within a type. 无需限定 ,事件名称必须将事件命名为在当前样式 TargetType 的类型中找到,该类型包含 EventSetterEventTriggerWithout qualification, eventName must name an event as found in the type that is the TargetType of the current style containing the EventSetter or EventTrigger.

用于限定事件名称的类型。The type to use to qualify the event name. 如果提供不带前缀的类型,则类型应为默认 XAML 命名空间中的类型,并且可以映射到现有 CLR 类型。If provided without a prefix, type is expected to be a type within the default XAML namespace, and that can be mapped to an existing CLR type. 对于自定义事件,或属于默认 XAML 命名空间之外的类型的事件,类型的字符串可以包含映射的 xaml 命名空间的前缀。For custom events, or events that are on types outside of the default XAML namespace, the string for type can include a prefix for a mapped XAML namespace. 该 XAML 命名空间应包含可映射到后备 CLR 类型的 XAML 类型,并且该 CLR 类型应定义所需的路由事件标识符。That XAML namespace should contain the XAML type that can map to a backing CLR type, and that CLR type should define the desired routed event identifier. 有关 XAML 命名空间映射的详细信息,请参阅WPF xaml 的 Xaml 命名空间和命名空间映射For details on XAML namespace mapping, see XAML Namespaces and Namespace Mapping for WPF XAML.



获取路由事件的处理程序类型。Gets the handler type of the routed event.


获取路由事件的标识名称。Gets the identifying name of the routed event.


获取路由事件的已注册所有者类型。Gets the registered owner type of the routed event.


获取路由事件的路由策略。Gets the routing strategy of the routed event.



将另一个所有者类型与 RoutedEvent 实例所表示的路由事件相关联,并允许事件的路由和其处理。Associates another owner type with the routed event represented by a RoutedEvent instance, and enables routing of the event and its handling.


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

(Inherited from Object)

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

(Inherited from Object)

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

(Inherited from Object)

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

(Inherited from Object)

返回此 RoutedEvent 的字符串表示形式。Returns the string representation of this RoutedEvent.

Applies to