From e44e117bb38e6acb2f0b4cb31c3c95696d5d4345 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 20 Jun 2021 16:45:42 +0800 Subject: [PATCH] fixed #632 --- .../HandyControl_Shared/Themes/Theme.cs | 5 + .../HandyControl_Shared/Themes/Theme.xaml | 192 +++++++++--------- .../Tools/Helper/ResourceHelper.cs | 16 +- 3 files changed, 113 insertions(+), 100 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Themes/Theme.cs b/src/Shared/HandyControl_Shared/Themes/Theme.cs index 2d49405e..6718f571 100644 --- a/src/Shared/HandyControl_Shared/Themes/Theme.cs +++ b/src/Shared/HandyControl_Shared/Themes/Theme.cs @@ -228,4 +228,9 @@ namespace HandyControl.Themes MergedDictionaries.Add(GetTheme()); } } + + public class StandaloneTheme : Theme + { + public override ResourceDictionary GetTheme() => ResourceHelper.GetTheme(true); + } } diff --git a/src/Shared/HandyControl_Shared/Themes/Theme.xaml b/src/Shared/HandyControl_Shared/Themes/Theme.xaml index 6d27d4e3..0a03e0c7 100644 --- a/src/Shared/HandyControl_Shared/Themes/Theme.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Theme.xaml @@ -6329,10 +6329,10 @@ - - - - + + + + @@ -6363,10 +6363,10 @@ - - - - + + + + @@ -6418,10 +6418,10 @@ - - - - + + + + @@ -6479,10 +6479,10 @@ - - - - + + + + @@ -7685,10 +7685,10 @@ - - - - + + + + @@ -7733,10 +7733,10 @@ - - - - + + + + @@ -7802,10 +7802,10 @@ - - - - + + + + @@ -7877,10 +7877,10 @@ - - - - + + + + @@ -8007,10 +8007,10 @@ - - - - + + + + @@ -8055,10 +8055,10 @@ - - - - + + + + @@ -8124,10 +8124,10 @@ - - - - + + + + @@ -8199,10 +8199,10 @@ - - - - + + + + @@ -9094,10 +9094,10 @@ - - - - + + + + @@ -9132,10 +9132,10 @@ - - - - + + + + @@ -9192,10 +9192,10 @@ - - - - + + + + @@ -9258,10 +9258,10 @@ - - - - + + + + @@ -9361,10 +9361,10 @@ - - - - + + + + @@ -9392,10 +9392,10 @@ - - - - + + + + @@ -9478,10 +9478,10 @@ - - - - + + + + @@ -9536,10 +9536,10 @@ - - - - + + + + @@ -10549,10 +10549,10 @@ - - - - + + + + @@ -10597,10 +10597,10 @@ - - - - + + + + @@ -10666,10 +10666,10 @@ - - - - + + + + @@ -10741,10 +10741,10 @@ - - - - + + + + diff --git a/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs b/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs index b357a5ce..29840ca0 100644 --- a/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs +++ b/src/Shared/HandyControl_Shared/Tools/Helper/ResourceHelper.cs @@ -85,14 +85,22 @@ namespace HandyControl.Tools /// get HandyControl theme /// /// - public static ResourceDictionary GetTheme() + public static ResourceDictionary GetTheme(bool standalone = false) { - HcTheme ??= new ResourceDictionary + if (!standalone) + { + HcTheme ??= new ResourceDictionary + { + Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml") + }; + + return HcTheme; + } + + return new ResourceDictionary { Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml") }; - - return HcTheme; } } }