void UpdateToolbar() { _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); var appbarLayout = NativeView.FindViewById <ViewGroup>(Microsoft.Maui.Resource.Id.navigationlayout_appbar); if (appbarLayout == null || VirtualView is not IToolbarElement te) { return; } var nativeToolBar = te.Toolbar?.ToNative(MauiContext, true); if (nativeToolBar == null || nativeToolBar.Parent == nativeToolBar) { return; } appbarLayout.AddView(nativeToolBar, 0); }