public void SetElement(VisualElement element)
        {
            if (element != null && !(element is NavigationPage))
            {
                throw new ArgumentException("Element must be a Page", nameof(element));
            }

            NavigationPage oldElement = Element;

            Element = (NavigationPage)element;

            if (oldElement != null)
            {
                oldElement.PushRequested      -= OnPushRequested;
                oldElement.PopRequested       -= OnPopRequested;
                oldElement.PopToRootRequested -= OnPopToRootRequested;
                oldElement.InternalChildren.CollectionChanged -= OnChildrenChanged;
                oldElement.PropertyChanged -= OnElementPropertyChanged;
            }

            if (element != null)
            {
                if (_container == null)
                {
                    _container = new PageControl();
                    _container.PointerPressed += OnPointerPressed;
                    _container.SizeChanged    += OnNativeSizeChanged;
                    _container.BackClicked    += OnBackClicked;

                    Tracker = new BackgroundTracker <PageControl>(Control.BackgroundProperty)
                    {
                        Element = (Page)element, Container = _container
                    };

                    SetPage(Element.CurrentPage, false, false);

                    _container.Loaded   += OnLoaded;
                    _container.Unloaded += OnUnloaded;
                }

                _container.DataContext = Element.CurrentPage;

                UpdatePadding();
                LookupRelevantParents();
                UpdateTitleColor();
                UpdateNavigationBarBackground();
                UpdateToolbarPlacement();

                // Enforce consistency rules on toolbar (show toolbar if top-level page is Navigation Page)
                _container.ShouldShowToolbar = _parentMasterDetailPage == null && _parentTabbedPage == null;
                if (_parentTabbedPage != null)
                {
                    Element.Appearing += OnElementAppearing;
                }

                Element.PropertyChanged    += OnElementPropertyChanged;
                Element.PushRequested      += OnPushRequested;
                Element.PopRequested       += OnPopRequested;
                Element.PopToRootRequested += OnPopToRootRequested;
                Element.InternalChildren.CollectionChanged += OnChildrenChanged;

                if (!string.IsNullOrEmpty(Element.AutomationId))
                {
                    _container.SetValue(Windows.UI.Xaml.Automation.AutomationProperties.AutomationIdProperty, Element.AutomationId);
                }

                PushExistingNavigationStack();
            }

            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));
        }