Post SelectIndexCentered to the dispatcher
Otherwise, the layout for the ListBox is not ready, and calling _listBox.SelectIndex(bestIndex); causes virtualization issues (all the items in the list are realized, causing the UI to underperform)
This commit is contained in:
Родитель
478636e547
Коммит
3dbfd2303c
|
@ -27,6 +27,7 @@ using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml.Templates;
|
using Avalonia.Markup.Xaml.Templates;
|
||||||
|
using Avalonia.Threading;
|
||||||
using AvaloniaEdit.Utils;
|
using AvaloniaEdit.Utils;
|
||||||
|
|
||||||
namespace AvaloniaEdit.CodeCompletion
|
namespace AvaloniaEdit.CodeCompletion
|
||||||
|
@ -321,7 +322,7 @@ namespace AvaloniaEdit.CodeCompletion
|
||||||
_currentList = listBoxItems;
|
_currentList = listBoxItems;
|
||||||
//_listBox.Items = null; Makes no sense? Tooltip disappeared because of this
|
//_listBox.Items = null; Makes no sense? Tooltip disappeared because of this
|
||||||
_listBox.ItemsSource = listBoxItems;
|
_listBox.ItemsSource = listBoxItems;
|
||||||
SelectIndexCentered(bestIndex);
|
Dispatcher.UIThread.Post(() => { SelectIndexCentered(bestIndex); }, DispatcherPriority.Loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче