Class RoutedEventArgs
Represents event arguments for routed events in the Telerik WinControls framework, providing comprehensive information about the event's routing state, direction, and original event data.
Inheritance
Inherited Members
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll
Syntax
public class RoutedEventArgs : EventArgs
Remarks
The RoutedEventArgs class extends the standard System.EventArgs to provide specialized functionality for the routed event system. It maintains information about the original CLR event arguments, the routed event definition, routing direction, and cancellation state.
This class serves as the base for all routed event argument types in the framework, ensuring consistent event handling patterns and providing the infrastructure necessary for event routing through the element tree. It preserves the original event data while adding routing-specific metadata required for proper event propagation.
Key features include preservation of original CLR event arguments, routing direction tracking, event cancellation support, and integration with the routed event infrastructure for consistent event handling across the framework.
Constructors
RoutedEventArgs(EventArgs, RoutedEvent)
Initializes a new instance of the RoutedEventArgs class with the specified original event arguments and routed event definition.
Declaration
public RoutedEventArgs(EventArgs args, RoutedEvent routedEvent)
Parameters
System.EventArgs
args
The original System.EventArgs from the CLR event that triggered this routed event. |
RoutedEvent
routedEvent
The RoutedEvent definition that describes the routed event being processed. |
Remarks
This constructor creates a new routed event arguments instance that preserves the original CLR event data while associating it with a specific routed event definition. This design allows the routed event system to maintain full fidelity with the original event information while adding routing capabilities.
The original event arguments are stored and can be accessed through the OriginalEventArgs property, allowing event handlers to access all the original event data as needed. The routed event definition provides metadata about routing behavior, event identity, and handling requirements.
Properties
Canceled
Gets or sets a value indicating whether the routed event processing should be canceled.
Declaration
public bool Canceled { get; set; }
Property Value
System.Boolean
|
Remarks
When this property is set to true
, the routed event system stops further routing
of the event through the element tree. This allows event handlers to prevent the event
from reaching other elements, effectively canceling the event processing.
Event cancellation is particularly useful in tunneling (preview) events where parent elements may want to prevent child elements from receiving certain events based on validation, security, or business logic requirements.
Direction
Gets or sets the routing direction for this routed event instance.
Declaration
public RoutingDirection Direction { get; set; }
Property Value
RoutingDirection
A RoutingDirection enumeration value indicating whether the event is tunneling or bubbling. |
Remarks
This property indicates the current routing direction of the event as it travels through the element tree. The direction affects which elements receive the event and in what order:
- Tunnel: Event travels from root down to target element
- Bubble: Event travels from target element up to root
Event handlers can use this information to implement different logic based on whether they are receiving the event during the preview (tunnel) phase or the main (bubble) phase of event processing.
OriginalEventArgs
Gets or sets the original event arguments from the CLR event that triggered this routed event.
Declaration
public EventArgs OriginalEventArgs { get; set; }
Property Value
System.EventArgs
An System.EventArgs instance containing the original event data, or System.EventArgs.Empty if no original event data is available. |
Remarks
This property preserves the complete original event information from the underlying CLR event that initiated the routed event processing. This allows event handlers to access all the original event data, including specialized event argument types with additional properties specific to the original event.
For example, if a routed event was triggered by a mouse click, the original event arguments might contain mouse coordinates, button information, and other mouse-specific data that remains accessible through this property even after the event has been wrapped in the routed event system.
RoutedEvent
Gets or sets the routed event definition associated with this event arguments instance.
Declaration
public RoutedEvent RoutedEvent { get; set; }
Property Value
RoutedEvent
A RoutedEvent instance that defines the identity, routing behavior, and handling requirements for this event. |
Remarks
This property provides access to the routed event definition that describes how this event should be routed through the element tree. The routed event definition contains metadata such as the event name, routing strategy, owner type, and handler type requirements.
Event handlers can use this property to determine the specific routed event being processed and access its metadata for advanced event handling scenarios, such as conditional processing based on event identity or routing behavior.