C#导航服务goback
我不想知道后窗的名字 我不知道该怎么做 目前,我的代码是:C#导航服务goback,c#,navigationservice,C#,Navigationservice,我不想知道后窗的名字 我不知道该怎么做 目前,我的代码是: if (this.NavigationService.CanGoBack) { this.NavigationService.GoBack(); } 这是我的示例->场景-这是主页中的我的框架 你可以把场景改写成这样 public MainPage() { InitializeComponent(); EventRegistration(); } private void EventRegistration(
if (this.NavigationService.CanGoBack)
{
this.NavigationService.GoBack();
}
这是我的示例->场景-这是主页中的我的框架 你可以把场景改写成这样
public MainPage()
{
InitializeComponent();
EventRegistration();
}
private void EventRegistration()
{
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
Scenes.Navigated += OnNavigated;
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
Scenes.CanGoBack ?
AppViewBackButtonVisibility.Visible :
AppViewBackButtonVisibility.Collapsed;
}
private void OnNavigated(object sender, NavigationEventArgs e)
{
if (sender is Frame)
{
var sc = sender as Frame;
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
sc.CanGoBack ?
AppViewBackButtonVisibility.Visible :
AppViewBackButtonVisibility.Collapsed;
}
}
private void OnBackRequested(object sender, BackRequestedEventArgs e)
{
if (Scenes.CanGoBack)
{
e.Handled = true;
Scenes.GoBack();
}
}