【问题标题】:Uwp 8.1 Full Screen C#Uwp 8.1 全屏 C#
【发布时间】:2016-10-11 14:44:56
【问题描述】:

我想知道如何在全屏模式下在 windows 10 上强制使用适用于 windows 8.1 的 UWP 应用程序。

ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;

对我不起作用,我没有方法PreferredLaunchWindowingMode

我也尝试获取 View,但我没有方法 TryToFullScreen,如 microsoft 指南中所述。

谢谢

【问题讨论】:

    标签: c# uwp


    【解决方案1】:

    据我所知,没有 API 可以让 Windows 8.1 应用程序处于全屏模式。 ApplicationView.PreferredLaunchWindowingModeApplicationView.GetForCurrentView 是 Windows 10 API。强烈建议将现有项目移植到通用 Windows 平台。

    但如果你真的想使用 Windows 8.1 应用程序中的新功能,有一个丑陋的解决方法来访问这些 API(使用反射):

    using System.Linq;
    using System.Reflection;
    ...
    var view = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
    var runtimeMethods = view.GetType().GetRuntimeMethods();// get the runtime methods
    var tryEnterFullScreenMode = runtimeMethods.FirstOrDefault(x => x.Name == "TryEnterFullScreenMode");
    tryEnterFullScreenMode?.Invoke(view, null);//invoke the tryEnterFullScreenMode method.
    

    【讨论】:

    【解决方案2】:

    你可以试试吗?

    ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多