0

我想知道如何在 UWP 应用程序上禁用指针模式。我已经设置了 XYFocusKeyboardNavigation,当我将我的 xbox one 控制器插入我的 PC 时,一切正常。每当我调试到我的控制台时,我都有一个指针而不是典型的 xbox 控件。我试图通过添加以下命令来禁用它,但没有任何效果,请帮助:

RequiresPointer="Never" //At Page Level

this.RequiresPointer = RequiresPointer.Never; //On Load

RequiresPointerMode = "WhenRequested" //In App.xaml

this.RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested; //tried on load but requirespointermode does not exist

Application.Current.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; //tried on load but got Error: System.NotSupportedException: 'Specified method is not supported.'
4

1 回答 1

1

每当我调试到我的控制台时,我都有一个指针而不是典型的 xbox 控件。我试图通过添加以下命令来禁用它,但没有任何效果,请帮助: this.RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested; //tried on load but requirespointermode does not exist

要关闭鼠标模式,请将以下内容添加到您的应用的构造函数中

应用程序.xaml.cs

public App()
{
    this.InitializeComponent();
    this.RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested;
    this.Suspending += OnSuspending;
}

笔记:

如果您正在编写 C++/DirectX 应用程序,则无需执行任何操作。鼠标模式仅适用于 HTML 和 XAML 应用程序。

有关更多详细信息,您可以参考如何禁用鼠标模式

于 2017-08-18T06:55:21.380 回答