Table of Contents

Class EventManager

Namespace
Stride.UI.Events
Assembly
Stride.UI.dll

Provides event-related utility methods that register routed events for class owners and add class handlers.

public static class EventManager
Inheritance
EventManager

Methods

GetRoutedEvent(Type, string)

Finds the routed event identified by its name and owner.

public static RoutedEvent GetRoutedEvent(Type ownerType, string eventName)

Parameters

ownerType Type

The type to start the search with. Base classes are included in the search.

eventName string

The event name.

Returns

RoutedEvent

The matching routed event identifier if any match is found; otherwise, null.

GetRoutedEvents()

Returns identifiers for routed events that have been registered to the event system.

public static RoutedEvent[] GetRoutedEvents()

Returns

RoutedEvent[]

An array of type RoutedEvent that contains the registered objects.

GetRoutedEventsForOwner(Type)

Finds all routed event identifiers for events that are registered with the provided owner type.

public static RoutedEvent[] GetRoutedEventsForOwner(Type ownerType)

Parameters

ownerType Type

The type to start the search with. Base classes are included in the search.

Returns

RoutedEvent[]

An array of matching routed event identifiers if any match is found; otherwise, null.

RegisterClassHandler<T>(Type, RoutedEvent<T>, EventHandler<T>, bool)

Registers a class handler for a particular routed event, with the option to handle events where event data is already marked handled.

public static void RegisterClassHandler<T>(Type classType, RoutedEvent<T> routedEvent, EventHandler<T> handler, bool handledEventsToo = false) where T : RoutedEventArgs

Parameters

classType Type

The type of the class that is declaring class handling.

routedEvent RoutedEvent<T>

The routed event identifier of the event to handle.

handler EventHandler<T>

A reference to the class handler implementation.

handledEventsToo bool

true to invoke this class handler even if arguments of the routed event have been marked as handled; false to retain the default behavior of not invoking the handler on any marked-handled event.

Type Parameters

T

Exceptions

ArgumentNullException

classType, routedEvent, or handler is null.

RegisterRoutedEvent<T>(string, RoutingStrategy, Type)

Registers a new routed event.

public static RoutedEvent<T> RegisterRoutedEvent<T>(string name, RoutingStrategy routingStrategy, Type ownerType) where T : RoutedEventArgs

Parameters

name string

The name of the routed event. The name must be unique within the owner type (base class included) and cannot be null or an empty string.

routingStrategy RoutingStrategy

The routing strategy of the event as a value of the enumeration.

ownerType Type

The owner class type of the routed event. This cannot be null.

Returns

RoutedEvent<T>

The identifier for the newly registered routed event. This identifier object can now be stored as a static field in a class and then used as a parameter for methods that attach handlers to the event. The routed event identifier is also used for other event system APIs.

Type Parameters

T

Exceptions

ArgumentNullException

name or ownerType is null.

InvalidOperationException

This exception is thrown if a routed event of name name already exists for type ownerType and parents.