Windows.Gaming.Input is a UWP namespace, to use it you need to create a UWP application. From your question (you included WindowsBase and System.Windows ), it looks like you created a WPF application, which is not the case.
You can create a UWP project with New -> Project -> Visual C# -> Windows -> Universal for a C # project and Other Languages -> Visual C++ -> Windows -> Universal for a C ++ project.
After that, it should work fine.

source share