Back to results for “Handlers”
.NET MAUI › Platform Integration & Handlers

How do you access a native view from a MAUI control?

Intermediate

Answer

Through the control's Handler.PlatformView, cast to the native type for the current platform (guarded by #if). This lets you call native APIs the cross-platform surface doesn't expose. Access it after the handler is created (e.g., in HandlerChanged).
myEntry.HandlerChanged += (s, e) =>
{
#if ANDROID
    var native = (Android.Widget.EditText)myEntry.Handler.PlatformView;
    native.SetSelectAllOnFocus(true);
#endif
};
Real-world example A form selects all text when an Entry gains focus on Android by reaching the native EditText via the handler.

Common follow-ups: When is PlatformView available? | Why guard with #if?