TitleBar back button for UWP

后端 未结 2 597
南笙
南笙 2020-12-30 04:42

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

2条回答
  •  长情又很酷
    2020-12-30 04:57

    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).

提交回复
热议问题