diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
index c17c05bc..de147646 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -223,6 +223,9 @@
Resources\Img\LeftMainContent\CheckBox_16x.png
+
+ Resources\Img\LeftMainContent\CheckBoxList_16x.png
+
Resources\Img\LeftMainContent\ColorPalette_16x.png
diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
index 0a009190..30396196 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -223,6 +223,9 @@
Resources\Img\LeftMainContent\CheckBox_16x.png
+
+ Resources\Img\LeftMainContent\CheckBoxList_16x.png
+
Resources\Img\LeftMainContent\ColorPalette_16x.png
diff --git a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json
index c1e8e21e..46df4ea8 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json
+++ b/src/Shared/HandyControlDemo_Shared/Data/DemoInfo.json
@@ -31,8 +31,8 @@
[ "ToolBar", "ToolBarDemoCtl", "ToolBar_16x", "" ],
[ "Border", "BorderDemoCtl", "BorderElement_16x", "" ],
[ "Label", "LabelDemoCtl", "Label_16x", "" ],
- [ "Frame", "FrameDemoCtl", "frame_16xLG", "1" ],
- [ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "1" ],
+ [ "Frame", "FrameDemoCtl", "frame_16xLG", "" ],
+ [ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "" ],
[ "Geometry", "GeometryDemoCtl", "Path_16x", "1" ]
]
},
@@ -57,6 +57,7 @@
[ "NumericUpDown", "NumericUpDownDemoCtl", "NumericListBox_16x", "" ],
[ "TextBox", "TextBoxDemoCtl", "TextBox_16x", "" ],
[ "ComboBox", "ComboBoxDemoCtl", "ComboBox_16x", "" ],
+ [ "CheckComboBox", "CheckComboBoxDemoCtl", "CheckBoxList_16x", "1" ],
[ "PasswordBox", "PasswordBoxDemoCtl", "PasswordBox_16x", "" ],
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "" ],
[ "DatePicker", "DatePickerDemoCtl", "DatePicker_16x", "" ],
@@ -104,7 +105,7 @@
[ "Notification", "NotificationDemoCtl", "Procedure_16x", "" ],
[ "Dialog", "DialogDemoCtl", "Dialog_16x", "" ],
[ "Screenshot", "ScreenshotDemoCtl", "WindowScreenshot_16x", "1" ],
- [ "Window", "WindowDemoCtl", "WindowsForm_16x", "1" ]
+ [ "Window", "WindowDemoCtl", "WindowsForm_16x", "" ]
]
},
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 1ae0db8c..9e2f6ce1 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -113,6 +113,9 @@
ChatBubbleDemoCtl.xaml
+
+ CheckComboBoxDemoCtl.xaml
+
CirclePanelDemoCtl.xaml
@@ -598,6 +601,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index 7f1a0b46..2762cd42 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -266,7 +266,18 @@ namespace HandyControlDemo.Properties.Langs {
return ResourceManager.GetString("CheckBox", resourceCulture);
}
}
-
+
+ ///
+ /// 查找类似 多选组合框 的本地化字符串。
+ ///
+ public static string CheckComboBox
+ {
+ get
+ {
+ return ResourceManager.GetString("CheckComboBox", resourceCulture);
+ }
+ }
+
///
/// 查找类似 圆形布局 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index 090e5b57..13e032a4 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
index 2edb2676..1ed78d51 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
index 57a16fd2..ea8e5781 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx
index 065145dc..460d7c8e 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ko-KR.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx
index ac7835dc..b4c05ff9 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.pt-BR.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index 34a270a9..2eca1695 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -759,4 +759,7 @@
几何形状
+
+ 多选组合框
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx
index 090e5b57..13e032a4 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.ru.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx
index b641cf03..deef133a 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.tr.resx
@@ -759,4 +759,7 @@
Geometry
+
+ CheckComboBox
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs
index 93ca4c9c..e8118f39 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/LangProvider.cs
@@ -60,7 +60,8 @@ namespace HandyControlDemo.Properties.Langs
OnPropertyChanged(nameof(ChatBubble));
OnPropertyChanged(nameof(Chatroom));
OnPropertyChanged(nameof(CheckBox));
- OnPropertyChanged(nameof(CirclePanel));
+ OnPropertyChanged(nameof(CheckComboBox));
+ OnPropertyChanged(nameof(CirclePanel));
OnPropertyChanged(nameof(Clear));
OnPropertyChanged(nameof(Click2Count));
OnPropertyChanged(nameof(Clock));
@@ -368,6 +369,11 @@ namespace HandyControlDemo.Properties.Langs
///
public string CheckBox => Lang.CheckBox;
+ ///
+ /// 查找类似 多选组合框 的本地化字符串。
+ ///
+ public string CheckComboBox => Lang.CheckComboBox;
+
///
/// 查找类似 圆形布局 的本地化字符串。
///
@@ -1447,6 +1453,11 @@ namespace HandyControlDemo.Properties.Langs
///
public static string CheckBox = nameof(CheckBox);
+ ///
+ /// 查找类似 多选组合框 的本地化字符串。
+ ///
+ public static string CheckComboBox = nameof(CheckComboBox);
+
///
/// 查找类似 圆形布局 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/CheckboxList_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/CheckboxList_16x.png
new file mode 100644
index 00000000..856bab79
Binary files /dev/null and b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/CheckboxList_16x.png differ
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CheckComboBoxDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CheckComboBoxDemoCtl.xaml
new file mode 100644
index 00000000..6487bf79
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CheckComboBoxDemoCtl.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CheckComboBoxDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CheckComboBoxDemoCtl.xaml.cs
new file mode 100644
index 00000000..44bbec67
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/CheckComboBoxDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class CheckComboBoxDemoCtl
+ {
+ public CheckComboBoxDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs b/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs
new file mode 100644
index 00000000..f7a87396
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBox.cs
@@ -0,0 +1,132 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ [TemplatePart(Name = ElementPanel, Type = typeof(Panel))]
+ [TemplatePart(Name = ElementSelectAll, Type = typeof(CheckComboBoxItem))]
+ public class CheckComboBox : ListBox
+ {
+ private const string ElementPanel = "PART_Panel";
+
+ private const string ElementSelectAll = "PART_SelectAll";
+
+ private Panel _panel;
+
+ private Popup _popup;
+
+ private CheckComboBoxItem _selectAllItem;
+
+ private bool _isInternalAction;
+
+ public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register(
+ "IsDropDownOpen", typeof(bool), typeof(CheckComboBox), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ public bool IsDropDownOpen
+ {
+ get => (bool) GetValue(IsDropDownOpenProperty);
+ set => SetValue(IsDropDownOpenProperty, ValueBoxes.BooleanBox(value));
+ }
+
+ public static readonly DependencyProperty TagStyleProperty = DependencyProperty.Register(
+ "TagStyle", typeof(Style), typeof(CheckComboBox), new PropertyMetadata(default(Style)));
+
+ public Style TagStyle
+ {
+ get => (Style) GetValue(TagStyleProperty);
+ set => SetValue(TagStyleProperty, value);
+ }
+
+ public static readonly DependencyProperty ShowSelectAllButtonProperty = DependencyProperty.Register(
+ "ShowSelectAllButton", typeof(bool), typeof(CheckComboBox), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ public bool ShowSelectAllButton
+ {
+ get => (bool) GetValue(ShowSelectAllButtonProperty);
+ set => SetValue(ShowSelectAllButtonProperty, ValueBoxes.BooleanBox(value));
+ }
+
+ public CheckComboBox() => AddHandler(Controls.Tag.ClosedEvent, new RoutedEventHandler(Tags_OnClosed));
+
+ private void Tags_OnClosed(object sender, RoutedEventArgs e)
+ {
+ if (e.OriginalSource is Tag tag && tag.Tag is CheckComboBoxItem checkComboBoxItem)
+ {
+ checkComboBoxItem.SetCurrentValue(IsSelectedProperty, false);
+ }
+ }
+
+ public override void OnApplyTemplate()
+ {
+ if (_selectAllItem != null)
+ {
+ _selectAllItem.Selected -= SelectAllItem_Selected;
+ _selectAllItem.Unselected -= SelectAllItem_Unselected;
+ }
+
+ base.OnApplyTemplate();
+
+ _panel = GetTemplateChild(ElementPanel) as Panel;
+ _selectAllItem = GetTemplateChild(ElementSelectAll) as CheckComboBoxItem;
+ if (_selectAllItem != null)
+ {
+ _selectAllItem.Selected += SelectAllItem_Selected;
+ _selectAllItem.Unselected += SelectAllItem_Unselected;
+ }
+ }
+
+ private void SwitchAllItems(bool selected)
+ {
+ if (_isInternalAction) return;
+ _isInternalAction = true;
+
+ foreach (CheckComboBoxItem item in ItemContainerGenerator.Items)
+ {
+ item.SetCurrentValue(ListBoxItem.IsSelectedProperty, selected);
+ }
+
+ _isInternalAction = false;
+ UpdateTags();
+ }
+
+ private void SelectAllItem_Selected(object sender, RoutedEventArgs e) => SwitchAllItems(true);
+
+ private void SelectAllItem_Unselected(object sender, RoutedEventArgs e) => SwitchAllItems(false);
+
+ protected override void OnSelectionChanged(SelectionChangedEventArgs e)
+ {
+ UpdateTags();
+ base.OnSelectionChanged(e);
+ }
+
+ private void UpdateTags()
+ {
+ if (_isInternalAction) return;
+
+ if (_selectAllItem != null)
+ {
+ _isInternalAction = true;
+ _selectAllItem.SetCurrentValue(IsSelectedProperty, SelectedItems.Count == Items.Count);
+ _isInternalAction = false;
+ }
+
+ _panel.Children.Clear();
+
+ foreach (var item in SelectedItems)
+ {
+ if (ItemContainerGenerator.ContainerFromItem(item) is CheckComboBoxItem checkComboBoxItem)
+ {
+ var tag = new Tag
+ {
+ Style = TagStyle,
+ Content = checkComboBoxItem.Content,
+ Tag = checkComboBoxItem
+ };
+ _panel.Children.Add(tag);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBoxItem.cs b/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBoxItem.cs
new file mode 100644
index 00000000..67e0dd7a
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Input/CheckComboBox/CheckComboBoxItem.cs
@@ -0,0 +1,9 @@
+using System.Windows.Controls;
+
+namespace HandyControl.Controls
+{
+ public class CheckComboBoxItem : ListBoxItem
+ {
+
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index e38ea129..edf474c4 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -31,6 +31,8 @@
+
+
@@ -440,6 +442,14 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckComboBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckComboBoxBaseStyle.xaml
new file mode 100644
index 00000000..e60f945c
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckComboBoxBaseStyle.xaml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/CheckComboBox.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/CheckComboBox.xaml
new file mode 100644
index 00000000..8656e2fc
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/CheckComboBox.xaml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
index 528eb309..4cba6b3c 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
@@ -25,6 +25,7 @@
+