如何禁用 Xbox One 的指针模式(C#、UWP)

How Can I Disable Pointer Mode For Xbox One (C#, UWP)

我想知道如何在 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.'

Whenever I debug to my console I have a pointer instead of typical xbox controls. I have tried to disable it by adding the following commands but nothing worked, please help: this.RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested; //tried on load but requirespointermode does not exist

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

App.xaml.cs

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

注:

If you are writing a C++/DirectX app, there's nothing to do. Mouse mode only applies to HTML and XAML applications.

详情请参考How to disable mouse mode