diff options
author | Eric Maupin <ermaup@microsoft.com> | 2018-05-04 19:26:30 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2018-05-04 20:07:59 +0300 |
commit | aad85a42219ddf493288ecdfa46fa24f8d1adc4f (patch) | |
tree | f8ce746c8bbd83408302e479473ab448072d98c5 /Xamarin.PropertyEditing | |
parent | 593bc542bd07146326600bb41c988def27bb8d89 (diff) |
[Core] Update SimpleCollectionView filter on setter regardless
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs | 5 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs | 21 |
2 files changed, 5 insertions, 21 deletions
diff --git a/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs b/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs index 8bd6f2f..2c8d57e 100644 --- a/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/ResourceSelectorViewModel.cs @@ -154,10 +154,7 @@ namespace Xamarin.PropertyEditing.ViewModels return; } - if (this.resourcesView.Options.Filter != ResourceFilter) - this.resourcesView.Options.Filter = ResourceFilter; - else - this.resourcesView.UpdateFilter(); + this.resourcesView.Options.Filter = ResourceFilter; } private bool ResourceFilter (object item) diff --git a/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs b/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs index c0b2245..f07f967 100644 --- a/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs +++ b/Xamarin.PropertyEditing/ViewModels/SimpleCollectionView.cs @@ -71,9 +71,8 @@ namespace Xamarin.PropertyEditing.ViewModels get { return this.filter; } set { - if (this.filter == value) - return; - + // Purposefully doesn't check for existing equality since a common case is setting to the same delegate but + // variables it checks only have changed. this.filter = value; OnPropertyChanged(); } @@ -112,19 +111,6 @@ namespace Xamarin.PropertyEditing.ViewModels public bool IsFiltering => Options?.Filter != null; - /// <summary> - /// Forces an update of the contens as if the filter has changed. - /// </summary> - /// <remarks> - /// Some filters may not change their delegate, but that delegate may act different based on outside forces. - /// In that scenario, call this to trigger the update. - /// </remarks> - public void UpdateFilter() - { - FilterCore (isPureSubset: this.wasFilterNull); - this.wasFilterNull = Options.Filter == null; - } - public IEnumerator GetEnumerator () { bool haveChildren = (Options.ChildOptions != null); @@ -215,7 +201,8 @@ namespace Xamarin.PropertyEditing.ViewModels private void OnOptionsPropertyChanged (object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(SimpleCollectionViewOptions.Filter)) { - UpdateFilter(); + FilterCore (isPureSubset: this.wasFilterNull); + this.wasFilterNull = Options.Filter == null; } else Reset(); } |