Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Maupin <ermaup@microsoft.com>2018-05-04 20:05:29 +0300
committerEric Maupin <ermaup@microsoft.com>2018-05-04 20:09:49 +0300
commita52eb1d5429963424a754280a51355dabf5b09ed (patch)
tree72c64ebd0ba76c9f01357af19b25897d6a8d2ab7 /Xamarin.PropertyEditing
parent7ac271fda7f503a1b395f1e1002fa0a6676fcb4d (diff)
[Core] Remove before adding new
Less items to search through for ordering if we remove filtered items before adding the new ones. Also some minor cleanup.
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r--Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs10
1 files changed, 4 insertions, 6 deletions
diff --git a/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs b/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs
index 6c45857..6d95003 100644
--- a/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs
+++ b/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs
@@ -134,9 +134,9 @@ namespace Xamarin.PropertyEditing.ViewModels
private readonly SimpleCollectionView parent;
private readonly string key;
private readonly object item;
+ private readonly IEnumerable source;
private SimpleCollectionViewOptions options;
private bool wasFilterNull;
- private IEnumerable source;
private IComparer<string> Comparer => Options?.DisplayComparer ?? Comparer<string>.Default;
@@ -238,6 +238,8 @@ namespace Xamarin.PropertyEditing.ViewModels
}
}
+ RemoveFiltered (toRemove, notify);
+
if (!isPureSubset) {
var toAdd = new List<string> (filteredOut.Count);
foreach (string key in filteredOut) {
@@ -250,8 +252,6 @@ namespace Xamarin.PropertyEditing.ViewModels
AddFiltered (toAdd, notify);
}
- RemoveFiltered (toRemove, notify);
-
if (hadChildren != HasChildElements)
OnPropertyChanged (nameof(HasChildElements));
}
@@ -375,15 +375,13 @@ namespace Xamarin.PropertyEditing.ViewModels
this.arranged.Add (sourceItem.Key, e);
- SimpleCollectionView childView = null;
IEnumerable children = (Options.ChildrenSelector != null) ? this.options.ChildrenSelector (sourceItem.Item) : sourceItem.Item as IEnumerable;
if (Options.ChildOptions != null) {
if (children == null) {
throw new InvalidOperationException ("ChildOptions specified, but element not enumerable or no selector");
}
- childView = new SimpleCollectionView (children, Options.ChildOptions, this, sourceItem.Key, sourceItem.Item);
- e.ChildrenView = childView;
+ e.ChildrenView = new SimpleCollectionView (children, Options.ChildOptions, this, sourceItem.Key, sourceItem.Item);
}
if (!filtering || this.options.Filter (e.Item))