support for sync with system theme

This commit is contained in:
NaBian committed 2021-05-30 14:50:38 +08:00
1 parent d997aee5f7
commit 3da5662a90
10 files changed
+111 -46

No files matched your search

@@ -337,7 +337,7 @@ namespace HandyControl.Controls
}
public static void SetCanUnselectAllWithBlankArea(DependencyObject element, bool value)
=> element.SetValue(CanUnselectAllWithBlankAreaProperty, value);
=> element.SetValue(CanUnselectAllWithBlankAreaProperty, ValueBoxes.BooleanBox(value));
public static bool GetCanUnselectAllWithBlankArea(DependencyObject element)
=> (bool) element.GetValue(CanUnselectAllWithBlankAreaProperty);
@@ -20,7 +20,7 @@ namespace HandyControl.Controls
new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
public static void SetAutoWidth(DependencyObject element, bool value)
=> element.SetValue(AutoWidthProperty, value);
=> element.SetValue(AutoWidthProperty, ValueBoxes.BooleanBox(value));
public static bool GetAutoWidth(DependencyObject element)
=> (bool) element.GetValue(AutoWidthProperty);
@@ -141,7 +141,7 @@ namespace HandyControl.Controls
}
public static void SetHideWhenClosing(DependencyObject element, bool value)
=> element.SetValue(HideWhenClosingProperty, value);
=> element.SetValue(HideWhenClosingProperty, ValueBoxes.BooleanBox(value));
public static bool GetHideWhenClosing(DependencyObject element)
=> (bool) element.GetValue(HideWhenClosingProperty);
@@ -28,7 +28,7 @@ namespace HandyControl.Controls
"ShowEmpty", typeof(bool), typeof(Empty), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
public static void SetShowEmpty(DependencyObject element, bool value)
=> element.SetValue(ShowEmptyProperty, value);
=> element.SetValue(ShowEmptyProperty, ValueBoxes.BooleanBox(value));
public static bool GetShowEmpty(DependencyObject element)
=> (bool) element.GetValue(ShowEmptyProperty);
@@ -2,6 +2,7 @@
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Tools;
using HandyControl.Tools.Helper;
using HandyControl.Tools.Interop;
namespace HandyControl.Controls
@@ -14,17 +15,9 @@ namespace HandyControl.Controls
EnableBlur(this);
}
private static SystemVersionInfo GetSystemVersionInfo()
{
var osv = new InteropValues.RTL_OSVERSIONINFOEX();
osv.dwOSVersionInfoSize = (uint) Marshal.SizeOf(osv);
InteropMethods.Gdip.RtlGetVersion(out osv);
return new SystemVersionInfo((int) osv.dwMajorVersion, (int) osv.dwMinorVersion, (int) osv.dwBuildNumber);
}
internal static void EnableBlur(Window window)
{
var versionInfo = GetSystemVersionInfo();
var versionInfo = SystemHelper.GetSystemVersionInfo();
if (versionInfo < SystemVersionInfo.Windows10 ||
versionInfo >= SystemVersionInfo.Windows10_1903)