Handlers — .Net Maui

Swetha vennapusa
Nerd For Tech
Published in
2 min readFeb 15, 2023

--

Overview

We all know that .Net MAUI is the evolution of Xamarin Forms. .Net MAUI provides you with a set of Cross Platform controls. To customise these controls with their native implementation we use .Net Maui Handler architectural concept. .Net Maui Handlers are similar to Xamarin form renderers. For changing one property we need to write tons of code in the Xamarin forms renderer. Unlike renderers, Handlers provides you with an easy way to achieve native implementation and better performance.

Every Control in .Net MAUI has its own handler and every handler has its own mapper. Handlers are responsible for instantiating the underlying native view and mapping the cross-platform control API to the native view API.

Mappers

Mappers are a key concept in .NET MAUI handlers, usually providing a property mapper and sometimes a command mapper, which maps the cross-platform control’s API to the native view’s API. This customisation, which modifies the native views for the cross-platform control, is achieved by modifying the mapper for a handler with one of the following methods:

  • PrependToMapping modifies the mapper for a handler before the .NET MAUI control mappings have been applied.
  • ModifyMapping modifies an existing mapping.
  • AppendToMapping which modifies the mapper for a handler after the .NET MAUI control mappings have been applied.

--

--