Ver código fonte

Don't coerce when deselecting a range.

If the deselection happens because of a `Clear` during a source collection changed event handler, then the selected indexes may not be in the valid range of the post-change items. In this case, we still want the items to be cleared, and not coercing the range has no downside.
Steven Kirk 5 anos atrás
pai
commit
b5f81e5290
1 arquivos alterados com 1 adições e 6 exclusões
  1. 1 6
      src/Avalonia.Controls/Selection/SelectionModel.cs

+ 1 - 6
src/Avalonia.Controls/Selection/SelectionModel.cs

@@ -242,12 +242,7 @@ namespace Avalonia.Controls.Selection
         {
             using var update = BatchUpdate();
             var o = update.Operation;
-            var range = CoerceRange(start, end);
-
-            if (range.Begin == -1)
-            {
-                return;
-            }
+            var range = new IndexRange(start, end);
 
             if (RangesEnabled)
             {