Windows 10通用应用程序 - 默认情况下以全屏模式运行

Joz*_*sky 6 windows-runtime windows-store-apps windows-10 uwp windows-10-universal

我有目标Windows 8.1的应用程序,当我在Windows 10上运行此应用程序时,它默认在小窗口中运行.

因为它是主要的平板电脑应用程序,我需要它默认以全屏模式运行.是否可以在Visual Studio或应用程序的某些配置中将其设置为某个位置?

Jus*_* XL 24

要以全屏模式启动应用程序,请尝试ApplicationView.PreferredLaunchWindowingModeApp.xaml.cs构造函数中进行设置

public App()
{
    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
Run Code Online (Sandbox Code Playgroud)

要有一个切换全屏模式的按钮,请执行

var view = ApplicationView.GetForCurrentView();
if (view.IsFullScreenMode)
{
    view.ExitFullScreenMode();
}
else
{
    view.TryEnterFullScreenMode();
}
Run Code Online (Sandbox Code Playgroud)

但是,我需要添加即使不指定上述任何代码,当您在启用了平板电脑模式的Windows 10平板电脑或Windows 10桌面中打开应用程序时,该应用程序将自动最大化为全屏.

只要您的应用程序在Windows 10桌面设备上可用,我建议您不要在启动时将其设置为全屏"因为UX明智,桌面用户使用窗口化应用程序会更容易.