A handler connects a .NET MAUI control abstraction to its platform-specific native control. It acts as the glue between virtual views and native views, applying cross-platform properties through platform-specific mappings. section 11.3.1
Each control and platform has its own handler. A handler exposes PlatformView for the native control and stores property mappings that translate values such as BackgroundColor into platform-specific types. section 11.3.1 section 11.3.1
Customize an existing handler through its mapper:
- Use PrependToMapping to add a mapping before the default mappings without overriding them. section 11.3.2
- Use ModifyMapping to change an existing mapping, supplying that mapping’s default key. section 11.3.2
- Use AppendToMapping to apply a customization after the defaults; this is the recommended choice in most cases. section 11.3.2
- Place mappings in MauiProgram startup logic or in the relevant platform folders. section 11.3.2
Removing an Entry border
Suppose a custom stepper uses an Entry that looks too prominent, but .NET MAUI exposes no property for controlling its border. Append a mapping to EntryHandler.Mapper, give it a key such as RemoveBorder, and use the supplied handler instance to customize its PlatformView. The mapping action also receives the corresponding cross-platform view. section 11.3 section 11.3.2
Figure 11.11 Cross-platform controls are described by interfaces, and virtual views implement them as controls in the .NET MAUI UI layer. Handlers map the abstractions to platform-specific implementations.
Use the architecture diagram to trace a control from its cross-platform interface through its virtual view and handler to the platform-specific implementation. section 11.3.1
