diff --git a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
index cda95d2ebbc..8533e1e1762 100644
--- a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
+++ b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj
@@ -12,6 +12,7 @@
+
diff --git a/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs
index 589f85f2080..0597e88ed6b 100644
--- a/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs
+++ b/src/Windows/Avalonia.Direct2D1/HwndRenderTarget.cs
@@ -1,4 +1,5 @@
using Avalonia.Platform;
+using Avalonia.Win32;
using Avalonia.Win32.Interop;
using SharpDX;
using SharpDX.DXGI;
@@ -21,7 +22,7 @@ protected override SwapChain1 CreateSwapChain(Factory2 dxgiFactory, SwapChainDes
protected override Size2F GetWindowDpi()
{
- if (UnmanagedMethods.ShCoreAvailable)
+ if (UnmanagedMethods.ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8)
{
uint dpix, dpiy;
diff --git a/src/Windows/Avalonia.Win32/FramebufferManager.cs b/src/Windows/Avalonia.Win32/FramebufferManager.cs
index 699dc7c25d7..0240ac9701c 100644
--- a/src/Windows/Avalonia.Win32/FramebufferManager.cs
+++ b/src/Windows/Avalonia.Win32/FramebufferManager.cs
@@ -87,7 +87,7 @@ private void DrawAndUnlock()
private Vector GetCurrentDpi()
{
- if (UnmanagedMethods.ShCoreAvailable)
+ if (UnmanagedMethods.ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8)
{
var monitor =
UnmanagedMethods.MonitorFromWindow(_hwnd, UnmanagedMethods.MONITOR.MONITOR_DEFAULTTONEAREST);
diff --git a/src/Windows/Avalonia.Win32/PlatformConstants.cs b/src/Windows/Avalonia.Win32/PlatformConstants.cs
index af1eca29bef..9dd4780637c 100644
--- a/src/Windows/Avalonia.Win32/PlatformConstants.cs
+++ b/src/Windows/Avalonia.Win32/PlatformConstants.cs
@@ -1,8 +1,13 @@
+using System;
+
namespace Avalonia.Win32
{
- static class PlatformConstants
+ public static class PlatformConstants
{
public const string WindowHandleType = "HWND";
public const string CursorHandleType = "HCURSOR";
+
+ public static readonly Version Windows8 = new Version(6, 2);
+ public static readonly Version Windows7 = new Version(6, 1);
}
}
diff --git a/src/Windows/Avalonia.Win32/Win32GlManager.cs b/src/Windows/Avalonia.Win32/Win32GlManager.cs
index e159ba3b78b..e70ea521065 100644
--- a/src/Windows/Avalonia.Win32/Win32GlManager.cs
+++ b/src/Windows/Avalonia.Win32/Win32GlManager.cs
@@ -1,4 +1,3 @@
-using System;
using Avalonia.OpenGL;
using Avalonia.OpenGL.Angle;
using Avalonia.OpenGL.Egl;
@@ -9,7 +8,6 @@ namespace Avalonia.Win32
{
static class Win32GlManager
{
- private static readonly Version Windows7 = new Version(6, 1);
public static void Initialize()
{
@@ -22,7 +20,7 @@ public static void Initialize()
return wgl;
}
- if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > Windows7)
+ if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > PlatformConstants.Windows7)
{
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay());
diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs
index a881c45cd0f..c011a458c30 100644
--- a/src/Windows/Avalonia.Win32/Win32Platform.cs
+++ b/src/Windows/Avalonia.Win32/Win32Platform.cs
@@ -94,7 +94,7 @@ public class Win32PlatformOptions
namespace Avalonia.Win32
{
- class Win32Platform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform, IPlatformIconLoader, IPlatformLifetimeEventsImpl
+ public class Win32Platform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform, IPlatformIconLoader, IPlatformLifetimeEventsImpl
{
private static readonly Win32Platform s_instance = new Win32Platform();
private static Thread _uiThread;
diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs
index 0b7bd13082c..3b7d3efa2f5 100644
--- a/src/Windows/Avalonia.Win32/WindowImpl.cs
+++ b/src/Windows/Avalonia.Win32/WindowImpl.cs
@@ -764,8 +764,8 @@ private void CreateWindow()
RegisterTouchWindow(_hwnd, 0);
}
- if (ShCoreAvailable)
- {
+ if (ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8)
+ {
var monitor = MonitorFromWindow(
_hwnd,
MONITOR.MONITOR_DEFAULTTONEAREST);