Controls/CheckComboBox: Apply AllItemsSelectedContent only when more than 1 items are selected
This commit is contained in:
@@ -124,19 +124,24 @@ namespace Elwig.Controls {
|
||||
SelectItemsReverse();
|
||||
var dmp = !string.IsNullOrEmpty(ListDisplayMemberPath) ? ListDisplayMemberPath : !string.IsNullOrEmpty(DisplayMemberPath) ? DisplayMemberPath : null;
|
||||
if (SelectedItems.Count == ItemsSource.Cast<object>().Count() && AllItemsSelectedContent != null) {
|
||||
_textBox.Text = AllItemsSelectedContent;
|
||||
AllItemsSelected = true;
|
||||
} else if (SelectedItems.Count == 0) {
|
||||
_textBox.Text = "";
|
||||
AllItemsSelected = false;
|
||||
} else {
|
||||
AllItemsSelected = null;
|
||||
}
|
||||
if (SelectedItems.Count > 1 && SelectedItems.Count == ItemsSource.Cast<object>().Count() && AllItemsSelectedContent != null) {
|
||||
_textBox.Text = AllItemsSelectedContent;
|
||||
} else if (SelectedItems.Count == 0) {
|
||||
_textBox.Text = "";
|
||||
} else {
|
||||
_textBox.Text = string.Join(Delimiter,
|
||||
dmp == null ? SelectedItems.Cast<object>() :
|
||||
SelectedItems.Cast<object>()
|
||||
.Select(i => i.GetType().GetProperty(dmp)?.GetValue(i))
|
||||
);
|
||||
AllItemsSelected = null;
|
||||
}
|
||||
|
||||
RaiseEvent(new SelectionChangedEventArgs(SelectionChangedEvent, evt.RemovedItems, evt.AddedItems));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user