I have not found another way to do this, so here is my approach.
The following IsWindows10 property determines whether a Windows 8.1 or Windows Phone 8.1 application is running on a Windows 10 device (including Windows 10 Mobile).
#region IsWindows10 static bool? _isWindows10; public static bool IsWindows10 => (_isWindows10 ?? (_isWindows10 = getIsWindows10Sync())).Value; static bool getIsWindows10Sync() { bool hasWindows81Property = typeof(Windows.ApplicationModel.Package).GetRuntimeProperty("DisplayName") != null; bool hasWindowsPhone81Property = typeof(Windows.Graphics.Display.DisplayInformation).GetRuntimeProperty("RawPixelsPerViewPixel") != null; bool isWindows10 = hasWindows81Property && hasWindowsPhone81Property; return isWindows10; }
How it works?
On Windows 8.1, the Package class has a DisplayName property, which is not found on Windows Phone 8.1. On Windows Phone 8.1, the DisplayInformation class has the RawPixelsPerViewPixel property, which is not found on Windows 8.1. Windows 10 (including Mobile) has both features. This is how we can determine which OS the application is running on.
source share