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>2019-03-11 20:15:20 +0300
committerEric Maupin <ermaup@microsoft.com>2019-03-11 21:29:59 +0300
commit325faec8484ebe2c49c544a34d5bdf489cc8ad5f (patch)
tree9728f3ffce110511a24a471bd72eda118845e7d7 /Xamarin.PropertyEditing.Windows
parent91a24876f4f4211b3fb07b87746682acd4c9faae (diff)
[Win] Don't subscribe every selection change
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r--Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
index d951eba..5962cd0 100644
--- a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
+++ b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
@@ -151,7 +151,7 @@ namespace Xamarin.PropertyEditing.Windows
}
if (ArrangeMode == PropertyArrangeMode.Name)
- UpdateBinding (ArrangeMode);
+ UpdateBinding (ArrangeMode, contentsOnly: true);
UpdateIcon ();
}
@@ -200,17 +200,20 @@ namespace Xamarin.PropertyEditing.Windows
SetCurrentValue (ArrangeModeProperty, this.vm.ArrangeMode);
}
- private void UpdateBinding (PropertyArrangeMode arrangeMode)
+ private void UpdateBinding (PropertyArrangeMode arrangeMode, bool contentsOnly = false)
{
if (this.items == null)
return;
if (arrangeMode == PropertyArrangeMode.Name) {
this.items.ItemsSource = (this.vm.ArrangedEditors.Count > 0) ? this.vm.ArrangedEditors[0].Editors : null;
- this.vm.ArrangedPropertiesChanged += OnArrangedByNamePropertiesChanged;
+ if (!contentsOnly)
+ this.vm.ArrangedPropertiesChanged += OnArrangedByNamePropertiesChanged;
} else {
- this.vm.ArrangedPropertiesChanged -= OnArrangedByNamePropertiesChanged;
- this.items.SetBinding (ItemsControl.ItemsSourceProperty, new Binding ("ArrangedEditors"));
+ if (!contentsOnly)
+ this.vm.ArrangedPropertiesChanged -= OnArrangedByNamePropertiesChanged;
+
+ this.items.SetBinding (ItemsControl.ItemsSourceProperty, new Binding (nameof(PanelViewModel.ArrangedEditors)));
}
if (this.vm != null)