Skip to end of metadata
Go to start of metadata

The following examples show how to add an event handler for a routed event by using code.

Example

Description

The controls in ClientUI generally have event fields that corresponds to each routed event available in the control. For example, the Click event field in UXButton control allows you to handle its corresponding Click routed event using language-specific operator.

The following code example shows how to add an event handler using C# operator syntax.

Code

XAML
C#

Example 

Description 

The following code examples shows how to use the AddHandler method to handle the Click routed event of a UXButton

Code

XAML
C#

Example

Description

Routed event introduces a concept whereby the event handler can be marked as handled to stop the event to be routed to the next node. This is done by setting the Handled property of the event data to true. 

ClientUI provides instance handlers with "handledEventsToo" mechanism whereby listeners can still run handlers in response to routed events where Handled is true in the event data. 

The following code examples shows how to use the AddHandler(RoutedEvent, Delegate, Boolean) method to handle a routed event that is invoked regardless of the Handled property value.

Please note an import to Intersoft.Client.Framework is required to use the AddHandler extension method. For instance, the reference import in C# code is: using Intersoft.Client.Framework.

Code

C#

Example

Description

In addition to the AddHandler(RoutedEvent, Delegate, Boolean) extension method, you can also use the static method ISEventManager.RegisterInstanceHandler to handle a routed event that is invoked regardless of the Handled property value.

Code

C#