Creating a custom handler
In the previous recipe, we set the selection color for an editor in the HandlerChanged
event, which is typically raised only once for a control. But what if we want to make the selection color dynamic, for instance, when a user selects a new theme? Since HandlerChanged
won’t be raised again, we wouldn’t be able to set the native property responsible for the selection color. We will achieve our goal with a custom handler and a property mapper.
Property mapper
A property mapper is an object that maps properties from a cross-platform control to platform-specific views.
Property mappers are called each time a cross-platform property is changed – this will allow us to dynamically update the platform view when a cross-platform property changes.
In this recipe, we’ll achieve the same effect of changing the selection color as in the previous recipe, but this time, using a custom handler and mapper.
Getting ready
To follow...