问题
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