17

I've seen that the windows settings are using a back button in the title bar; and would like to include something like that in my UAP but since Win10 is pretty new I couldn't find any information if this is achievable in a simple way.

Thanks very much

Freggar
  • 1,049
  • 1
  • 11
  • 24
  • similar question answered with some useful information [here](http://stackoverflow.com/questions/30597585/windows-10-uap-back-button?answertab=active#tab-top) – Yang C Oct 19 '15 at 08:38
  • use `SystemNavigationManager` http://stackoverflow.com/questions/31832309/handling-back-navigationn-windows-10-uwp/35875842#35875842 – Vineet Choudhary Mar 08 '16 at 19:09

2 Answers2

35

You can activate the back button easily like this:

using Windows.UI.Core;

var currentView = SystemNavigationManager.GetForCurrentView();
currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

Please note, that the back event is handled with the BackRequested event on the same view:

currentView.BackRequested += // Event handler goes here

Please note: The back button is only displayed in the title bar, when the app is running in desktop mode. When the app is running in tablet mode, the back button is moved to the Windows task bar (bottom left).

Stefan Over
  • 5,851
  • 2
  • 35
  • 61
  • 3
    If you want to handle it everywhere in your project. Use it in your App.xaml.cs as shown [here](http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps) – aloisdg Jun 26 '16 at 14:50
  • implement back button for all pages check this link => https://developerinsider.co/handle-back-button-pressed-in-uwp/ – Ronald Saunfe Nov 15 '20 at 16:23
10

Although the suggested answer still works as of Win10 1803, with the release of 1709 Microsoft began discouraging the use of AppViewBackButton in favor of an in-app back button. Here's some XAML:

<Button VerticalAlignment="Top" HorizontalAlignment="Left" 
Style="{StaticResource NavigationBackButtonNormalStyle}"/>

Read more: https://learn.microsoft.com/en-us/windows/uwp/design/basics/navigation-history-and-backwards-navigation

Mapplesoft
  • 297
  • 5
  • 13