@@ -100,7 +100,8 @@ public class TextBoxHelper
100100 { typeof ( TimePicker ) , TimePickerBase . SelectedDateTimeProperty } ,
101101 { typeof ( DateTimePicker ) , DateTimePicker . SelectedDateTimeProperty } ,
102102 { typeof ( ColorPicker ) , ColorPickerBase . SelectedColorProperty } ,
103- { typeof ( ColorCanvas ) , ColorPickerBase . SelectedColorProperty }
103+ { typeof ( ColorCanvas ) , ColorPickerBase . SelectedColorProperty } ,
104+ { typeof ( MultiSelectionComboBox ) , MultiSelectionComboBox . SelectedItemProperty }
104105 } ;
105106
106107 /// <summary>
@@ -122,6 +123,7 @@ public static void SetIsSpellCheckContextMenuEnabled(UIElement element, bool val
122123 [ Category ( AppName . MahApps ) ]
123124 [ AttachedPropertyBrowsableForType ( typeof ( TextBox ) ) ]
124125 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
126+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
125127 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
126128 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
127129 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -392,6 +394,7 @@ public static void SetIsMonitoring(DependencyObject obj, bool value)
392394 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
393395 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
394396 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
397+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
395398 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
396399 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
397400 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -406,6 +409,7 @@ public static string GetWatermark(DependencyObject obj)
406409 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
407410 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
408411 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
412+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
409413 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
410414 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
411415 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -426,6 +430,7 @@ public static void SetWatermark(DependencyObject obj, string value)
426430 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
427431 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
428432 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
433+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
429434 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
430435 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
431436 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -443,6 +448,7 @@ public static TextAlignment GetWatermarkAlignment(DependencyObject obj)
443448 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
444449 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
445450 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
451+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
446452 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
447453 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
448454 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -463,6 +469,7 @@ public static void SetWatermarkAlignment(DependencyObject obj, TextAlignment val
463469 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
464470 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
465471 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
472+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
466473 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
467474 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
468475 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -480,6 +487,7 @@ public static TextTrimming GetWatermarkTrimming(DependencyObject obj)
480487 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
481488 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
482489 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
490+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
483491 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
484492 [ AttachedPropertyBrowsableForType ( typeof ( TimePickerBase ) ) ]
485493 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
@@ -516,6 +524,7 @@ public static void SetWatermarkWrapping(DependencyObject obj, TextWrapping value
516524 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
517525 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
518526 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
527+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
519528 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
520529 [ AttachedPropertyBrowsableForType ( typeof ( HotKeyBox ) ) ]
521530 [ AttachedPropertyBrowsableForType ( typeof ( ColorPicker ) ) ]
@@ -536,6 +545,7 @@ public static void SetUseFloatingWatermark(DependencyObject obj, bool value)
536545 [ AttachedPropertyBrowsableForType ( typeof ( TextBoxBase ) ) ]
537546 [ AttachedPropertyBrowsableForType ( typeof ( PasswordBox ) ) ]
538547 [ AttachedPropertyBrowsableForType ( typeof ( ComboBox ) ) ]
548+ [ AttachedPropertyBrowsableForType ( typeof ( MultiSelectionComboBox ) ) ]
539549 [ AttachedPropertyBrowsableForType ( typeof ( DatePicker ) ) ]
540550 [ AttachedPropertyBrowsableForType ( typeof ( NumericUpDown ) ) ]
541551 public static bool GetHasText ( DependencyObject obj )
@@ -896,7 +906,7 @@ public static void ButtonClicked(object sender, RoutedEventArgs e)
896906 {
897907 var button = ( Button ) sender ;
898908
899- var parent = button . GetAncestors ( ) . FirstOrDefault ( a => a is RichTextBox || a is TextBox || a is PasswordBox || a is ComboBox || a is ColorPickerBase ) ;
909+ var parent = button . GetAncestors ( ) . FirstOrDefault ( a => a is RichTextBox || a is TextBox || a is PasswordBox || a is ComboBox || a is ColorPickerBase || a is MultiSelectionComboBox ) ;
900910
901911 var command = GetButtonCommand ( parent ) ;
902912 var commandParameter = GetButtonCommandParameter ( parent ) ?? parent ;
@@ -927,6 +937,26 @@ public static void ButtonClicked(object sender, RoutedEventArgs e)
927937 passwordBox . Clear ( ) ;
928938 passwordBox . GetBindingExpression ( PasswordBoxBindingBehavior . PasswordProperty ) ? . UpdateSource ( ) ;
929939 }
940+ else if ( parent is MultiSelectionComboBox multiSelectionComboBox )
941+ {
942+ if ( multiSelectionComboBox . HasCustomText )
943+ {
944+ multiSelectionComboBox . UpdateEditableText ( ) ;
945+ }
946+ else
947+ {
948+ switch ( multiSelectionComboBox . SelectionMode )
949+ {
950+ case SelectionMode . Single :
951+ multiSelectionComboBox . SelectedItem = null ;
952+ break ;
953+ case SelectionMode . Multiple :
954+ case SelectionMode . Extended :
955+ multiSelectionComboBox . SelectedItems . Clear ( ) ;
956+ break ;
957+ }
958+ }
959+ }
930960 else if ( parent is ComboBox comboBox )
931961 {
932962 if ( comboBox . IsEditable )
@@ -942,6 +972,7 @@ public static void ButtonClicked(object sender, RoutedEventArgs e)
942972 {
943973 colorPicker . SetCurrentValue ( ColorPickerBase . SelectedColorProperty , null ) ;
944974 }
975+
945976 }
946977 }
947978
0 commit comments