RoutedEvent Class

Definition

代表與識別路由事件,並宣告其特性。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")]
public sealed class RoutedEvent
[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
Inheritance
RoutedEvent
Attributes

Remarks

此類別包含 NameRoutingStrategyHandlerTypeOwnerType 屬性。This class contains the Name, RoutingStrategy, HandlerType, and OwnerType properties. 這些成員都不可以有 null 值。None of these members can have null values.

此類別具有 XAML 用法,專門用來提供 EventTrigger (或衍生類別)之 RoutedEvent 屬性的值,或針對 EventSetterEvent 屬性(或衍生類別)。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 Attribute UsageXAML Attribute Usage

<object property="eventName"/>  

-或--or-

<object property="type.eventName"/>  

XAML 值XAML Values

eventNameeventName
不合格的事件名稱,相當於 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. 如果沒有限定 ,事件名稱就必須將事件命名為在類型中找到,這是包含 EventSetterEventTrigger之目前樣式的 TargetTypeWithout 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.

Properties

HandlerType

取得路由事件的處理常式型別。Gets the handler type of the routed event.

Name

取得路由事件的識別名稱。Gets the identifying name of the routed event.

OwnerType

取得路由事件的註冊擁有人型別。Gets the registered owner type of the routed event.

RoutingStrategy

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

Methods

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)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

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

Applies to