标题栏后退键UWP标题栏、UWP

2023-09-04 00:27:07 作者:大明湖畔

我见过的Windows设置,使用的是后退按钮标题酒吧;并希望有类似的东西在我的UAP但由于Win10是pretty的新我找不到任何信息,如果这是可以实现以简单的方式。

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.

非常感谢

推荐答案

您可以轻松地激活后退按钮这样的:

You can activate the back button easily like this:

using Windows.UI.Core;

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

请注意,背面事件与同一视图中的 BackRequested 事件处理:

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

currentView.BackRequested += // Event handler goes here

请注意:后退按钮只显示在标题栏中,当应用程序在桌面模式下运行。当应用程序在平板模式下运行,返回按钮移动到Windows任务栏(左下)。

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