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
The MyItemList is an ObservableCollection.
When I add a new Item to the Top of the list via MyItemList.Insert(0, ...) and run a this.RaisePropertyChanged(nameof(MyItemList));, the space of the new item in the ItemsRepeater is used but the item itself is not rendered. This does not happen from the very beginning but after some (not so long) time. I think shortly after when the first items runs out of the visible part of the Window.
If I scroll just a pixel in the ScrollViewer, everything is where and how it should be immediately.
This does not happen, if the ScrollViewer is not involved.
This is how it looks like:
To Reproduce
Create a new Avalonia Project from scratch with Desktop enabled. Leave everything else at default.
Make the following changes:
Add the Avalonia.ItemsRepeater Nuget to the main project
Replace code in MainViewModel.cs with this:
using System.Collections.ObjectModel;
using System;
using ReactiveUI;
namespace AvaloniaApplication1.ViewModels;
public class MainViewModel : ViewModelBase
{
public ObservableCollection<MyModel> MyItemList { get; set; } = new ObservableCollection<MyModel>();
private readonly System.Timers.Timer _TmrDisruptionUpdate = new(1000);
public MainViewModel()
{
MyItemList.Add(new MyModel() { Text = "foobar"});
MyItemList.Add(new MyModel() { Text = "Hello World" });
MyItemList.Add(new MyModel() { Text = "John Doe" });
MyItemList.Add(new MyModel() { Text = "xxxxx" });
_TmrDisruptionUpdate.Elapsed += _TmrDisruptionUpdate_Elapsed;
_TmrDisruptionUpdate.Start();
}
private void _TmrDisruptionUpdate_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
MyItemList.Insert(0, new MyModel() { Text = DateTime.Now.ToString() });
this.RaisePropertyChanged(nameof(MyItemList));
}
}
Create a new class called MyModel.cs with the following content:
namespace AvaloniaApplication1.ViewModels
{
public class MyModel
{
public string Text { get; set; }
}
}
Describe the bug
I have this:
The
MyItemList
is an ObservableCollection.When I add a new Item to the Top of the list via
MyItemList.Insert(0, ...)
and run athis.RaisePropertyChanged(nameof(MyItemList));
, the space of the new item in theItemsRepeater
is used but the item itself is not rendered. This does not happen from the very beginning but after some (not so long) time. I think shortly after when the first items runs out of the visible part of the Window.If I scroll just a pixel in the
ScrollViewer
, everything is where and how it should be immediately.This does not happen, if the
ScrollViewer
is not involved.This is how it looks like:
To Reproduce
Create a new Avalonia Project from scratch with Desktop enabled. Leave everything else at default.
Make the following changes:
Avalonia.ItemsRepeater
Nuget to the main projectMainViewModel.cs
with this:MyModel.cs
with the following content:I create a sample project with the things above:
ScrollViewerRenderIssue.zip
Expected behavior
Also later added items are rendered as the first items that were added.
Avalonia version
11.1.4
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: