diff options
author | Eric Maupin <ermaup@microsoft.com> | 2019-03-09 02:05:32 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2019-03-09 02:35:03 +0300 |
commit | 80ac6b07fff280e0dda5dca0faa5098a83346b45 (patch) | |
tree | 2a347fc87f3cd94a6b51546cfb2a99c701ae4eb2 /Xamarin.PropertyEditing.Windows | |
parent | a22461eaec83ffccdb90c057298b6d5e83ac60c5 (diff) |
[Win] Use same update mechanism as mac on named
Instead of making sure that the [0] binding updates correctly with the
binding system in WPF, it's simpler to just reuse the same system as mac
to set the top level itemssource. This collection is currently reset
when the filter opens up.
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
-rw-r--r-- | Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs index 84ea7d8..d951eba 100644 --- a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs +++ b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs @@ -205,21 +205,22 @@ namespace Xamarin.PropertyEditing.Windows if (this.items == null) return; - Binding itemsSource = null; if (arrangeMode == PropertyArrangeMode.Name) { - if (SelectedItems.Count > 0) - itemsSource = new Binding ("ArrangedEditors[0].Editors") { FallbackValue = null }; - } else - itemsSource = new Binding ("ArrangedEditors"); - - if (itemsSource != null) - this.items.SetBinding (ItemsControl.ItemsSourceProperty, itemsSource); - else - this.items.ItemsSource = null; + this.items.ItemsSource = (this.vm.ArrangedEditors.Count > 0) ? this.vm.ArrangedEditors[0].Editors : null; + this.vm.ArrangedPropertiesChanged += OnArrangedByNamePropertiesChanged; + } else { + this.vm.ArrangedPropertiesChanged -= OnArrangedByNamePropertiesChanged; + this.items.SetBinding (ItemsControl.ItemsSourceProperty, new Binding ("ArrangedEditors")); + } if (this.vm != null) this.vm.ArrangeMode = arrangeMode; } + + private void OnArrangedByNamePropertiesChanged (object sender, EventArgs e) + { + this.items.ItemsSource = (this.vm.ArrangedEditors.Count > 0) ? this.vm.ArrangedEditors[0].Editors : null; + } } internal enum EditingPane |