You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After quickly scrolling up and down in the ListBox, some extra display items appear mysteriously, as shown in the figure, such as 80 and 86.
To Reproduce
ViewModel
public class TestViewModel : ViewModelBase
{
public class MyClass(string text, bool isImage)
{
public string Text { get; set; } = text;
// Load random exception image
public Bitmap? Image { get; set; } = isImage ? new Bitmap("/Users/lin/Pictures/截屏与录制/2484ed39-3cf6-4393-8dc4-fddfcee410b3.png") : null;
}
public ObservableCollection<MyClass> List { get; set; }
public MyClass SelectedItem { get; set; }
public TestViewModel()
{
List = [];
for (int i = 0; i < 300; i++)
{
List.Add(new MyClass($"测试{i}", i % 3 == 0));
}
SelectedItem = List[0];
}
}
Backend code
private void ClipItem_OnPointerEntered(object? sender, PointerEventArgs e)
{
if (sender is Control { Parent: ListBoxItem listBoxItem }) listBoxItem.IsSelected = true;
}
Does it reproduce without selection on pointer over?
You can try to change this line:
- if (sender is Control { Parent: ListBoxItem listBoxItem }) listBoxItem.IsSelected = true;+ if (sender is Control { Parent: ListBoxItem listBoxItem }) listBoxItem.SetCurrentValue(ListBoxItem.IsSelectedProperty, true);
Describe the bug
After quickly scrolling up and down in the ListBox, some extra display items appear mysteriously, as shown in the figure, such as 80 and 86.
To Reproduce
ViewModel
Backend code
View
Expected behavior
No abnormal display occurs
Avalonia version
11.2.3
OS
macOS
Additional context
No response
The text was updated successfully, but these errors were encountered: