Windows-XAML/Template10

GestureService shouldn't handle the BackRequested from SystemNavigationManager

jp-weber opened this issue · 0 comments

Currently the BackRequested event of SystemNavigationManager is handled in the service and in tablet mode the navigation gestures do not work as intended. Since the event is not handled as true, the system back button navigates back and minimizes the app.

https://github.com/Windows-XAML/Template10/blob/master/Source/Template10.Core/Services/Gesture/GestureService.cs#L149

I would suggest to remove this from the service and treat it as best practice in the ShellPage.

        private void SetupGestures()
        {
            _navManager.BackRequested += NavManager_BackRequested;
            ShellView.BackRequested += async (s, e) => await NavigationService.GoBackAsync();
        }
        private async void NavManager_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (NavigationService.CanGoBack())
            {
                e.Handled = true;
                await NavigationService.GoBackAsync();
            }
        }