void InitializeComponent() { SetAlignment(-1, -1); SetWeight(1, 1); SetLayoutCallback(OnLayout); _viewStack = new SimpleViewStack(Forms.NativeParent); if (Device.Idiom == TargetIdiom.Phone) { _viewStack.BackgroundColor = ElmSharp.Color.White; } _viewStack.Show(); PackEnd(_viewStack); _navBar = new ShellNavBar(); _navBar.Show(); PackEnd(_navBar); IShellSectionController controller = ShellSection; controller.NavigationRequested += OnNavigationRequested; controller.AddDisplayedPageObserver(this, UpdateDisplayedPage); ((IShellController)Shell.Current).AddAppearanceObserver(this, ShellSection); ((IShellController)Shell.Current).AddFlyoutBehaviorObserver(_navBar); _shellSectionRenderer = CreateShellSectionRenderer(ShellSection); _shellSectionRenderer.NativeView.Show(); _viewStack.Push(_shellSectionRenderer.NativeView); Device.BeginInvokeOnMainThread(() => { (_shellSectionRenderer.NativeView as Widget)?.SetFocus(true); }); }