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

帅比萌擦擦* 提交于 2019-12-11 17:19:57

问题


I was wondering how I could disable pointer mode on a UWP application. I already have XYFocusKeyboardNavigation set up and everything works perfectly when I plug my xbox one controller into my PC. 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:

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.'

回答1:


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

To turn off mouse mode, add the following to the constructor for your app

App.xaml.cs

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

Note:

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

For more details you could refer to How to disable mouse mode.



来源:https://stackoverflow.com/questions/45747821/how-can-i-disable-pointer-mode-for-xbox-one-c-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!