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