From d997aee5f7a4612da250f5c27505f32aac9ea899 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sun, 30 May 2021 01:47:30 +0800 Subject: [PATCH] now hc styles can be referenced in window.resource by the way, supported multiple themes at the same time, It may be related to #574 --- .../Resources/DemoTheme.cs | 4 +- .../Controls/ColorPicker/ColorPicker.cs | 2 +- .../Controls/Growl/Growl.cs | 10 +-- .../Controls/Other/Gravatar.cs | 2 +- .../Controls/Other/Pagination.cs | 2 +- .../Other/TransitioningContentControl.cs | 2 +- .../HorizontalAlignmentPropertyEditor.cs | 12 +-- .../Editors/ReadOnlyTextPropertyEditor.cs | 2 +- .../Editors/SwitchPropertyEditor.cs | 2 +- .../VerticalAlignmentPropertyEditor.cs | 12 +-- .../Controls/Screenshot/ScreenshotWindow.cs | 2 +- .../Controls/TabControl/TabItem.cs | 2 +- .../Controls/Window/BlurWindow.cs | 4 +- .../Controls/Window/MessageBox.cs | 54 ++++++------- .../Controls/Window/PopupWindow.cs | 2 +- .../Controls/Window/Window.cs | 2 +- .../Properties/Langs/LangProvider.cs | 2 +- .../Properties/Langs/LangProvider.tt | 4 +- .../HandyControl_Shared/Themes/Theme.cs | 50 ++++++++++-- .../Tools/Helper/ResourceHelper.cs | 76 +++++++++---------- .../ButtonGroupItemStyleSelector.cs | 30 ++++---- .../ComboBoxItemCapsuleStyleSelector.cs | 6 +- .../TabItemCapsuleStyleSelector.cs | 6 +- 23 files changed, 161 insertions(+), 129 deletions(-) diff --git a/src/Shared/HandyControlDemo_Shared/Resources/DemoTheme.cs b/src/Shared/HandyControlDemo_Shared/Resources/DemoTheme.cs index d9d22af4..3b7d4966 100644 --- a/src/Shared/HandyControlDemo_Shared/Resources/DemoTheme.cs +++ b/src/Shared/HandyControlDemo_Shared/Resources/DemoTheme.cs @@ -11,9 +11,9 @@ namespace HandyControlDemo.Resources public override ResourceDictionary GetSkin(SkinType skinType) => ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skinType); - public override ResourceDictionary GetTheme() => new ResourceDictionary + public override ResourceDictionary GetTheme() => new Lazy(() => new ResourceDictionary { Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml") - }; + }).Value; } } diff --git a/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs b/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs index f8348369..668117e1 100644 --- a/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs +++ b/src/Shared/HandyControl_Shared/Controls/ColorPicker/ColorPicker.cs @@ -455,7 +455,7 @@ namespace HandyControl.Controls var button = new Button { Margin = new Thickness(6), - Style = ResourceHelper.GetResource