RoutedEvent RoutedEvent RoutedEvent 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=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
[System.ComponentModel.TypeConverter("System.Windows.Markup.RoutedEventConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public sealed class RoutedEvent
type RoutedEvent = class
Public NotInheritable Class RoutedEvent
继承
RoutedEventRoutedEventRoutedEventRoutedEvent
属性

注解

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

此类具有 XAML 用法RoutedEvent , 专用于提供EventTrigger (或派生类Event ) 的属性的值, 或EventSetter用于 (或派生类) 的属性的值。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"/>  

XAML 值XAML Values

eventNameeventName
Name RoutedEvent字段的属性等效的非限定事件名称, 而不是类型中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 , 该类型是包含EventSetterEventTrigger的当前样式的。Without qualification, eventName must name an event as found in the type that is the TargetType of the current style containing the EventSetter or EventTrigger.

typetype
用于限定事件名称的类型。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.

属性

HandlerType HandlerType HandlerType HandlerType

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

Name Name Name Name

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

OwnerType OwnerType OwnerType OwnerType

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

RoutingStrategy RoutingStrategy RoutingStrategy RoutingStrategy

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

方法

AddOwner(Type) AddOwner(Type) AddOwner(Type) AddOwner(Type)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

适用于