Skip to content

GestureService shouldn't handle the BackRequested from SystemNavigationManager #1730

@jp-weber

Description

@jp-weber

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();
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions