Skip to content
This repository has been archived by the owner on Aug 27, 2020. It is now read-only.

NavigationBackCommand

Mark Smith edited this page Sep 2, 2016 · 1 revision

NavigationBackCommand

The NavigationBackCommand is an ICommand implementation that uses the registered INavigationService to perform a GoBackAsync. It optionally can monitor the navigation stack and change the command state (CanExecute) based on whether pages exist on the stack.

Note: This class cannot be instantiated on it's own. Instead, a single instance of the command is exposed through a static property on the NavigationCommands class. You should use this property to execute the command.

Properties

  • MonitorNavigationStack : boolean indicating whether to monitor the navigation stack and flip the current CanExecute state for the command. By default this is turned off and the command is always valid, but you can set the property to true to enable this feature if you have some sort of global UI which can be enabled/disabled.

Example

<ContentPage ... xmlns:cmds="XamarinUniversity.Commands;assembly=XamU.Infrastructure" ...>
    ...
   <Button Text="Go Back" Command="{x:Static cmds:NavigationCommands.NavigateBackCommand}" />