From f4b1796f984800c90a799e97612446f77bdabacd Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Sat, 20 Jun 2020 18:48:13 +0800
Subject: [PATCH] added two editors
---
.../Themes/Styles/Window.xaml | 1 +
.../Data/Model/PropertyGridDemoModel.cs | 21 +++--
.../HandyControlDemo_Shared/MainWindow.xaml | 6 +-
.../Controls/PropertyGridDemoCtl.xaml | 12 ++-
.../Controls/PropertyGridDemoCtl.xaml.cs | 9 +-
.../UserControl/Main/NoUserContent.xaml | 3 +-
.../Window/BlurWindow.xaml | 1 +
.../Window/GlowWindow.xaml | 1 +
.../Controls/{Other => Button}/ButtonGroup.cs | 12 +--
.../HorizontalAlignmentPropertyEditor.cs | 70 ++++++++++++++
.../Editors/PropertyEditorBase.cs | 4 +-
.../VerticalAlignmentPropertyEditor.cs | 70 ++++++++++++++
.../Controls/PropertyGrid/PropertyResolver.cs | 23 +++--
.../Controls/Window/BlurWindow.cs | 6 --
.../Controls/Window/GlowWindow.cs | 6 --
.../HandyControl_Shared/Data/ResourceToken.cs | 12 +++
.../HandyControl_Shared.projitems | 5 +-
.../Themes/Basic/Geometries.xaml | 8 ++
.../Styles/Base/ButtonGroupBaseStyle.xaml | 6 +-
.../Styles/Base/PropertyGridBaseStyle.xaml | 2 +-
.../Themes/Styles/PropertyGrid.xaml | 93 ++++++++++++++++++-
.../ComboBoxItemCapsuleStyleSelector.cs | 30 ++++++
.../TabItemCapsuleStyleSelector.cs | 4 +-
23 files changed, 345 insertions(+), 60 deletions(-)
rename src/Shared/HandyControl_Shared/Controls/{Other => Button}/ButtonGroup.cs (66%)
create mode 100644 src/Shared/HandyControl_Shared/Controls/PropertyGrid/Editors/HorizontalAlignmentPropertyEditor.cs
create mode 100644 src/Shared/HandyControl_Shared/Controls/PropertyGrid/Editors/VerticalAlignmentPropertyEditor.cs
create mode 100644 src/Shared/HandyControl_Shared/Tools/StyleSelector/ComboBoxItemCapsuleStyleSelector.cs
diff --git a/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml b/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
index c0facbc9..31e4cf8d 100644
--- a/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
+++ b/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
@@ -55,6 +55,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/StyleSelector/ComboBoxItemCapsuleStyleSelector.cs b/src/Shared/HandyControl_Shared/Tools/StyleSelector/ComboBoxItemCapsuleStyleSelector.cs
new file mode 100644
index 00000000..de0379ec
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Tools/StyleSelector/ComboBoxItemCapsuleStyleSelector.cs
@@ -0,0 +1,30 @@
+using System.Windows;
+using System.Windows.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Tools
+{
+ public class ComboBoxItemCapsuleStyleSelector : StyleSelector
+ {
+ public override Style SelectStyle(object item, DependencyObject container)
+ {
+ if (container is ComboBoxItem comboBoxItem && VisualHelper.GetParent(comboBoxItem) is { } comboBox)
+ {
+ var count = comboBox.Items.Count;
+ if (count == 1)
+ {
+ return ResourceHelper.GetResource