PlatformView is a handler property that exposes the native control mapped to a .NET MAUI view. Handlers connect cross-platform abstractions to platform-specific implementations, allowing targeted UI customization when the shared API is not enough. section 11.3.1
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.
Follow the mapping from a cross-platform control through its virtual view and handler to the native platform control. section 11.3.1
Use PlatformView when adding platform-specific handler logic:
- Append a mapping to the relevant handler and restrict it to the custom view, such as BorderlessEntry. section 11.3.3
- Separate platform branches with compiler directives such as ANDROID, WINDOWS, and IOS || MACCATALYST. section 11.3.3
- Use handler.PlatformView to change native properties; for Android, the mapped Entry control is an AppCompatEditText. section 11.3.3
- Inspect the native control's available properties and methods with IntelliSense when determining the required customization. section 11.3.3
Removing an Android Entry border
Inside an EntryHandler mapping, set handler.PlatformView.Background to null and call SetBackgroundColor with Android.Graphics.Color.Transparent. Equivalent iOS, macOS, and Windows branches modify each platform's border and background properties. section 11.3.3 section 11.3.3
