Browse Source
Merge pull request #2968 from AvaloniaUI/fix/scroll-to-view-crash
fix crash scrolling to view when clearing list.
pull/2979/head
danwalmsley
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
5 deletions
-
src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs
-
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs
|
|
|
@ -295,11 +295,14 @@ namespace Avalonia.Controls.Presenters |
|
|
|
/// <inheritdoc/>
|
|
|
|
public override void ScrollIntoView(object item) |
|
|
|
{ |
|
|
|
var index = Items.IndexOf(item); |
|
|
|
|
|
|
|
if (index != -1) |
|
|
|
if (Items != null) |
|
|
|
{ |
|
|
|
ScrollIntoView(index); |
|
|
|
var index = Items.IndexOf(item); |
|
|
|
|
|
|
|
if (index != -1) |
|
|
|
{ |
|
|
|
ScrollIntoView(index); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1042,7 +1042,7 @@ namespace Avalonia.Controls.Primitives |
|
|
|
RaiseEvent(e); |
|
|
|
} |
|
|
|
|
|
|
|
if (AutoScrollToSelectedItem) |
|
|
|
if (AutoScrollToSelectedItem && _selectedIndex != -1) |
|
|
|
{ |
|
|
|
ScrollIntoView(_selectedItem); |
|
|
|
} |
|
|
|
|