/// <summary> /// Check that the current page is synchronised with the XCore navigation framework /// They can get our of wack as navigation can be kicked off by things outside the framework /// ... like the default back button in the NavigationPage /// </summary> /// <param name="direction"></param> void _synchroniseNavigation(NavigationDirection direction) { var page = _rootNavigationPage.CurrentPage; if (page != null && page.BindingContext != null) { if (page.BindingContext != _xNavigation.CurrentContentObject) { if (direction == NavigationDirection.Back) { _rootFrame.NavigateBack(); } else { _rootFrame.NavigateTo(page.BindingContext); } } } }
public UIElement Init(XFrame rootFrame, XViewModel rootViewModel, bool isRoot) { RootViewModel = rootViewModel; var rootPage = _viewResolver.ResolvePageType(rootViewModel); if (rootPage == null) { throw new InvalidOperationException("Could not resolve the inital views"); } UIElement rootElement = _configureNavigation(rootFrame, rootPage, isRoot); rootFrame.Init(); if (isRoot) { _dispatcher.Invoke(() => rootFrame.NavigateTo(rootViewModel)); } return(rootElement); }
public UIElement Init(XFrame rootFrame, XViewModel rootViewModel, bool isRoot) { RootViewModel = rootViewModel; var rootPage = _viewResolver.ResolvePageType(rootViewModel); if (rootPage == null) { throw new InvalidOperationException("Could not resolve the inital views"); } UIElement rootElement = _configureNavigation(rootFrame, rootPage, isRoot); rootFrame.Init(); if (isRoot) { _dispatcher.Invoke(() => rootFrame.NavigateTo(rootViewModel)); } return rootElement; }