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-01-12 00:30:24 +0300
committerEric Maupin <ermaup@microsoft.com>2019-01-12 00:30:24 +0300
commitaf0feca598a687e9c997229af264fb5bddbf9701 (patch)
tree9829b365333b335a6da1170ac4d0136f36ef1121
parent1ef475122d564e714f51a3bb61e69e90b992e544 (diff)
[Win] Don't bind with no name category
-rw-r--r--Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs24
1 files changed, 14 insertions, 10 deletions
diff --git a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
index 7355e6e..267390f 100644
--- a/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
+++ b/Xamarin.PropertyEditing.Windows/PropertyEditorPanel.cs
@@ -70,7 +70,7 @@ namespace Xamarin.PropertyEditing.Windows
}
public static readonly DependencyProperty ArrangeModeProperty = DependencyProperty.Register (
- nameof(ArrangeMode), typeof(PropertyArrangeMode), typeof(PropertyEditorPanel), new PropertyMetadata (PropertyArrangeMode.Name, (o, args) => ((PropertyEditorPanel)o).OnArrangeModeChanged ((PropertyArrangeMode)args.NewValue)));
+ nameof(ArrangeMode), typeof(PropertyArrangeMode), typeof(PropertyEditorPanel), new PropertyMetadata (PropertyArrangeMode.Name, (o, args) => ((PropertyEditorPanel)o).UpdateBinding ((PropertyArrangeMode)args.NewValue)));
public PropertyArrangeMode ArrangeMode
{
@@ -103,7 +103,7 @@ namespace Xamarin.PropertyEditing.Windows
OnTargetPlatformChanged();
if (this.vm.SelectedObjects.Count > 0 || ArrangeMode != PropertyArrangeMode.Name)
- OnArrangeModeChanged (ArrangeMode);
+ UpdateBinding (ArrangeMode);
}
private FrameworkElement root;
@@ -154,7 +154,7 @@ namespace Xamarin.PropertyEditing.Windows
}
if (ArrangeMode == PropertyArrangeMode.Name)
- OnArrangeModeChanged (ArrangeMode);
+ UpdateBinding (ArrangeMode);
UpdateIcon ();
}
@@ -203,21 +203,25 @@ namespace Xamarin.PropertyEditing.Windows
SetCurrentValue (ArrangeModeProperty, this.vm.ArrangeMode);
}
- private void OnArrangeModeChanged (PropertyArrangeMode newMode)
+ private void UpdateBinding (PropertyArrangeMode arrangeMode)
{
if (this.items == null)
return;
- Binding itemsSource;
- if (newMode == PropertyArrangeMode.Name)
- itemsSource = new Binding ("ArrangedEditors[0].Editors");
- else
+ Binding itemsSource = null;
+ if (arrangeMode == PropertyArrangeMode.Name) {
+ if (SelectedItems.Count > 0)
+ itemsSource = new Binding ("ArrangedEditors[0].Editors") { FallbackValue = null };
+ } else
itemsSource = new Binding ("ArrangedEditors");
- this.items.SetBinding (ItemsControl.ItemsSourceProperty, itemsSource);
+ if (itemsSource != null)
+ this.items.SetBinding (ItemsControl.ItemsSourceProperty, itemsSource);
+ else
+ this.items.ItemsSource = null;
if (this.vm != null)
- this.vm.ArrangeMode = newMode;
+ this.vm.ArrangeMode = arrangeMode;
}
}