Windows 10 通用应用程序 - 默认以全屏模式运行 [英] Windows 10 universal app - Run in fullscreen mode by default

查看:81
本文介绍了Windows 10 通用应用程序 - 默认以全屏模式运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have application with target windows 8.1 and when I run this application on Windows 10, it is run in small window by default.

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

Because it is primary tablet application I need it to run in full-screen mode by default. Is it possible to set it somewhere in Visual Studio or in some config of the application?

推荐答案

要以全屏模式启动应用程序,请尽早在 App.xaml.cs<中尝试设置 ApplicationView.PreferredLaunchWindowingMode/code> 的构造函数

To launch application in full screen mode, try setting ApplicationView.PreferredLaunchWindowingMode as early as in App.xaml.cs's constructor

public App()
{
    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

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

To have a button that toggles the full screen mode, do

var view = ApplicationView.GetForCurrentView();
if (view.IsFullScreenMode)
{
    view.ExitFullScreenMode();
}
else
{
    view.TryEnterFullScreenMode();
}

但是,我需要补充一点,即使没有指定上面的任何代码,当您在启用了平板电脑模式的 Windows 10 平板电脑或 Windows 10 台式机中打开您的应用程序时,该应用程序将自动将自身最大化到全屏.

However, I need to add that even without specifying any of the code above, when you open your app inside a Windows 10 tablet or a Windows 10 desktop with Tablet Mode enabled, the app will automatically maximise itself to full screen.

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

As long as your app is available on Windows 10 Desktop devices, I would recommend you not to set it to full screen at start-up 'cause UX wise it's a lot easier for desktop users to work with windowed applications.

这篇关于Windows 10 通用应用程序 - 默认以全屏模式运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆