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-03-15 22:53:36 +0300
committerEric Maupin <ermaup@microsoft.com>2018-03-15 22:53:36 +0300
commite5eb43df8a26ce939ae8cefb292a2244731f6e98 (patch)
treebcf81dc38e0c93f337303c3f3ccc78f8c2572751 /Xamarin.PropertyEditing
parent1944076dc2cf4dec0ae34f5a455d69f818caaddc (diff)
[Core] Fix multi-editor flags values
Diffstat (limited to 'Xamarin.PropertyEditing')
-rw-r--r--Xamarin.PropertyEditing/ViewModels/CombinablePropertyViewModel.cs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Xamarin.PropertyEditing/ViewModels/CombinablePropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/CombinablePropertyViewModel.cs
index e4b927a..92d5698 100644
--- a/Xamarin.PropertyEditing/ViewModels/CombinablePropertyViewModel.cs
+++ b/Xamarin.PropertyEditing/ViewModels/CombinablePropertyViewModel.cs
@@ -134,6 +134,9 @@ namespace Xamarin.PropertyEditing.ViewModels
using (await AsyncWork.RequestAsyncWork (this)) {
try {
+ // Snapshot current choices so we don't catch updates mid-push for multi-editors
+ var currentChoices = Choices.ToDictionary (c => c, c => c.IsFlagged);
+
foreach (IObjectEditor editor in Editors) {
ValueInfo<IReadOnlyList<TValue>> value = await editor.GetValueAsync<IReadOnlyList<TValue>> (Property, Variation);
HashSet<TValue> current;
@@ -142,14 +145,14 @@ namespace Xamarin.PropertyEditing.ViewModels
else
current = new HashSet<TValue> (value.Value);
- foreach (var choice in Choices) {
- if (!choice.IsFlagged.HasValue)
+ foreach (var choice in currentChoices) {
+ if (!choice.Value.HasValue)
continue;
- if (choice.IsFlagged.Value)
- current.Add (choice.Value);
+ if (choice.Value.Value)
+ current.Add (choice.Key.Value);
else
- current.Remove (choice.Value);
+ current.Remove (choice.Key.Value);
}
IReadOnlyList<TValue> values = current.ToArray ();