Libraries for UWP must be compiled separately, they must be assigned to UWP only and configured correctly. So
So I have ported XInputDotNet library for UWP apps. You
You can download prebuilded binaries from Unity Forum by this link. Also there is an instruction how to use it.
Using ported library you can continue using same code for different platforms.