2016-12-30 183 views

回答

-1
Navigation.RemovePage(Navigation.NavigationStack.Last()); 
Navigation.PopAsync(); 
+0

棱鏡的INavigationService不公開這些方法 –

+0

這些內容查看方法 – sunyt

+0

不幸的是,我需要把它在我的視圖模型,利用棱鏡的的NavigationService –

1

這應該工作

_navigationService.NavigateAsync("yourApp:///NavigationPage/YourPage") 

這相當於

MainPage = new NavigationPage(new YourPage()); 

注:我面臨崩潰問題iOS與導航這種方式。我解決它通過Device.RuntimePlatform

switch (Device.RuntimePlatform) 
{ 
    case Device.iOS: 
     _navigationService.NavigateAsync("YourPage"); 
     break; 
    case Device.Android: 
     _navigationService.NavigateAsync("yourApp:///NavigationPage/YourPage"); 
     break; 
    default: 
     _navigationService.NavigateAsync("YourPage"); 
     break; 
}