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=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
[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 用法, RoutedEvent專門用來提供EventTrigger (或衍生類別Event ) 的屬性值, 或EventSetter (或衍生類別) 的屬性 (property)。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). 如需有關、 EventTrigger EventSetter和這些類別之 XAML 用法的詳細資訊, 請參閱路由事件總覽For more information about EventTrigger, EventSetter, and the XAML usages for those classes, see Routed Events Overview.

XAML Attribute UsageXAML Attribute Usage

<object property="eventName"/>  


<object property="type.eventName"/>  


不合格的事件名稱, 相當於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 , 而此型別是EventSetter包含EventTrigger或之目前樣式的。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.

要用來限定事件名稱的類型。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 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

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

傳回這個 RoutedEvent 的字串表示。Returns the string representation of this RoutedEvent.