浏览代码

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 年之前
父节点
当前提交
b5f81e5290
共有 1 个文件被更改,包括 1 次插入6 次删除
  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)
             {