Table of Contents

Class Interactive

Namespace
Avalonia.Interactivity
Assembly
Avalonia.Base.dll

Base class for objects that raise routed events.

public class Interactive : Layoutable, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed
Inheritance
Interactive
Implements
Derived
Inherited Members
Extension Methods

Constructors

Interactive()

public Interactive()

Methods

AddHandler(RoutedEvent, Delegate, RoutingStrategies, bool)

Adds a handler for the specified routed event.

public void AddHandler(RoutedEvent routedEvent, Delegate handler, RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, bool handledEventsToo = false)

Parameters

routedEvent RoutedEvent

The routed event.

handler Delegate

The handler.

routes RoutingStrategies

The routing strategies to listen to.

handledEventsToo bool

Whether handled events should also be listened for.

AddHandler<TEventArgs>(RoutedEvent<TEventArgs>, EventHandler<TEventArgs>?, RoutingStrategies, bool)

Adds a handler for the specified routed event.

public void AddHandler<TEventArgs>(RoutedEvent<TEventArgs> routedEvent, EventHandler<TEventArgs>? handler, RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, bool handledEventsToo = false) where TEventArgs : RoutedEventArgs

Parameters

routedEvent RoutedEvent<TEventArgs>

The routed event.

handler EventHandler<TEventArgs>

The handler.

routes RoutingStrategies

The routing strategies to listen to.

handledEventsToo bool

Whether handled events should also be listened for.

Type Parameters

TEventArgs

The type of the event's args.

BuildEventRoute(RoutedEvent)

Builds an event route for a routed event.

protected EventRoute BuildEventRoute(RoutedEvent e)

Parameters

e RoutedEvent

The routed event.

Returns

EventRoute

An EventRoute describing the route.

Remarks

Usually, calling RaiseEvent(RoutedEventArgs) is sufficient to raise a routed event, however there are situations in which the construction of the event args is expensive and should be avoided if there are no handlers for an event. In these cases you can call this method to build the event route and check the HasHandlers property to see if there are any handlers registered on the route. If there are, call RaiseEvent(Interactive, RoutedEventArgs) to raise the event.

RaiseEvent(RoutedEventArgs)

Raises a routed event.

public void RaiseEvent(RoutedEventArgs e)

Parameters

e RoutedEventArgs

The event args.

RemoveHandler(RoutedEvent, Delegate)

Removes a handler for the specified routed event.

public void RemoveHandler(RoutedEvent routedEvent, Delegate handler)

Parameters

routedEvent RoutedEvent

The routed event.

handler Delegate

The handler.

RemoveHandler<TEventArgs>(RoutedEvent<TEventArgs>, EventHandler<TEventArgs>?)

Removes a handler for the specified routed event.

public void RemoveHandler<TEventArgs>(RoutedEvent<TEventArgs> routedEvent, EventHandler<TEventArgs>? handler) where TEventArgs : RoutedEventArgs

Parameters

routedEvent RoutedEvent<TEventArgs>

The routed event.

handler EventHandler<TEventArgs>

The handler.

Type Parameters

TEventArgs

The type of the event's args.