1

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 Answers1

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.

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • the definition this.RequiresPointerMode, Suspending and OnSuspending dont exist.... i tried to do that a while ago. Any ideas? – tadll122101 Aug 18 '17 at 07:09
  • The `RequiresPointerMode` is `Application` property, you should write the above code in your `App.xaml.cs` file. Or it will throw compile error. – CoCaIceDew Aug 18 '17 at 07:58
  • Thanks that worked.... The problem was as you said that i was trying to put the code in my main form instead of App.xaml.cs – tadll122101 Aug 18 '17 at 15:41