Browse Source

Fix removing selected items in ListBoxPage.

Previously, would remove all items if `AlwaysSelected` enabled.
Steven Kirk 5 years ago
parent
commit
172feab259
1 changed files with 4 additions and 2 deletions
  1. 4 2
      samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs

+ 4 - 2
samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs

@@ -38,9 +38,11 @@ namespace ControlCatalog.ViewModels
 
             RemoveItemCommand = ReactiveCommand.Create(() =>
             {
-                while (Selection.Count > 0)
+                var items = Selection.SelectedItems.ToList();
+
+                foreach (var item in items)
                 {
-                    Items.Remove(Selection.SelectedItems.First());
+                    Items.Remove(item);
                 }
             });