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();
|
SelectItemsReverse();
|
||||||
var dmp = !string.IsNullOrEmpty(ListDisplayMemberPath) ? ListDisplayMemberPath : !string.IsNullOrEmpty(DisplayMemberPath) ? DisplayMemberPath : null;
|
var dmp = !string.IsNullOrEmpty(ListDisplayMemberPath) ? ListDisplayMemberPath : !string.IsNullOrEmpty(DisplayMemberPath) ? DisplayMemberPath : null;
|
||||||
if (SelectedItems.Count == ItemsSource.Cast<object>().Count() && AllItemsSelectedContent != null) {
|
if (SelectedItems.Count == ItemsSource.Cast<object>().Count() && AllItemsSelectedContent != null) {
|
||||||
_textBox.Text = AllItemsSelectedContent;
|
|
||||||
AllItemsSelected = true;
|
AllItemsSelected = true;
|
||||||
} else if (SelectedItems.Count == 0) {
|
} else if (SelectedItems.Count == 0) {
|
||||||
_textBox.Text = "";
|
|
||||||
AllItemsSelected = false;
|
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 {
|
} else {
|
||||||
_textBox.Text = string.Join(Delimiter,
|
_textBox.Text = string.Join(Delimiter,
|
||||||
dmp == null ? SelectedItems.Cast<object>() :
|
dmp == null ? SelectedItems.Cast<object>() :
|
||||||
SelectedItems.Cast<object>()
|
SelectedItems.Cast<object>()
|
||||||
.Select(i => i.GetType().GetProperty(dmp)?.GetValue(i))
|
.Select(i => i.GetType().GetProperty(dmp)?.GetValue(i))
|
||||||
);
|
);
|
||||||
AllItemsSelected = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RaiseEvent(new SelectionChangedEventArgs(SelectionChangedEvent, evt.RemovedItems, evt.AddedItems));
|
RaiseEvent(new SelectionChangedEventArgs(SelectionChangedEvent, evt.RemovedItems, evt.AddedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user