avaloniaui / avalonia.controls.itemsrepeater Goto Github PK
View Code? Open in Web Editor NEWItemsRepeater is a light-weight control to generate and present a collection of items.
License: MIT License
ItemsRepeater is a light-weight control to generate and present a collection of items.
License: MIT License
Description
When using an ItemsRepeater control, the displayed items become out of sync with the items source after the items source is sorted. Display order is not respected, and other weird things can happen as well, including repeated visual elements which are not duplicated in the items source.
To Reproduce
The problem has persisted for me under a variety of circumstances. I have tried the following to fix the problem:
Scenario 1: When using ObservableCollection, I sort the items source using only the Move() method.
Scenario 2: When using ObservableCollection, I sort the items source in a temporary copy, then Clear() the items source and Add() from the sorted copy.
Scenario 3: When using a OneWay binding from the items source to ItemsRepeater.Items, I sort the items source in a temporary copy, destroy the original, assign the sorted copy to the items source, and then raise a PropertyChanged event.
CURRENT WORKAROUND: When a sort is completed, I destroy the previous ItemsRepeater and create a new one with the sorted items.
Expected behavior
The displayed items should match the source items, in both number and order, at all times.
Desktop
Additional context
This is my first project with Avalonia, so please tell me if you think I am doing something incorrectly.
There seems to be a problem with bring in to view calls for repeater items. This issue is related to repeater virtualization where item needs to be created and scrollbar position needs to be calculated before item can be brought in to view.
For this to work GetOrCreateElement was made public but usage of it is not relay user friendly and can cause some issues.
After call to GetOrCreateElement is made user will get new item but calling BringInToView will result in empty repeater viewport if user does not wait for layout pass to be finished.
This not only mean user is not quite sure when can BringInToView be called but also additional items can be added to repeaters source collection before layout pass is over and this can also lead to empty viewport.
So only option user has is to force layout update after GetOrCreateElement to make sure all is ready for BringInToView call.
I wonder if we can make BringInToView safer feature to use as I imagine bringing things in to view in the repeater is one of things users will need.
To demonstrate this I created small repository: https://github.com/igorstefus/AvaloniaRepeaterProblem/tree/master/RepeaterProblem
Describe the bug
See the screen recording.
ItemsControl does not have such issue.
To Reproduce
https://github.com/balthild/avalonia-itemsrepeater-issue
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:itemsrepeaterissue.ViewModels;assembly=itemsrepeaterissue"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="itemsrepeaterissue.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="itemsrepeaterissue">
<Design.DataContext>
<vm:MainWindowViewModel />
</Design.DataContext>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<ItemsRepeater Items="{Binding ItemGroups}" Margin="24">
<ItemsRepeater.Layout>
<StackLayout Spacing="24" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<StackPanel Spacing="8">
<StackPanel Name="GroupTitle" Orientation="Horizontal">
<TextBlock Text="{Binding Title}" FontSize="24" />
</StackPanel>
<ItemsRepeater Items="{Binding Items}">
<ItemsRepeater.Layout>
<UniformGridLayout MaximumRowsOrColumns="2"
MinColumnSpacing="12"
MinRowSpacing="12"
ItemsStretch="Fill" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border Padding="12" Background="#EEEEEE">
<StackPanel Spacing="6">
<TextBlock Text="Item name:" />
<TextBlock Text="{Binding}" />
</StackPanel>
</Border>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</StackPanel>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
</Window>
using System.Collections.Generic;
using System.Linq;
namespace itemsrepeaterissue.ViewModels {
public class MainWindowViewModel : ViewModelBase {
public class ItemGroup {
public string Title { get; }
public IEnumerable<string> Items { get; }
public ItemGroup(string title, IEnumerable<string> items) {
Title = title;
Items = items;
}
}
public IEnumerable<ItemGroup> ItemGroups =>
new[] { 20, 20, 5, 2, 2, 2 }.Select(n => {
return new ItemGroup(
$"Group with {n} items",
Enumerable.Range(0, n).Select(i => $"Item {i}")
);
});
}
}
Desktop (please complete the following information):
Describe the bug
ItemsRepeater
using UniformGridLayout
with 9 or more children gives the exception when you scroll it back and forth. It seems like ItemsRepeater
does not load all the binded items together and unloads items that are unreachable by the user which might cause this kind of problems. It unloads the first item in my collection when I scroll to the bottom (you can see it in Avalonia DevTools) and does not load it back, leaving just blank space and crashing after I attempt to scroll again.
To Reproduce
Steps to reproduce the behavior:
UserControl
with the size of 244x226 and margins 0 20 19 0 (a Panel
with random background should work)ViewModel
that has an AvaloniaList<UserControl>
to bind ItemsRepeater
toViewModel
constructor, add 10 or more UserControl
to the AvaloniaList
ScrollViewer
with the size of 572x510, put ItemsRepeater
with UniformGridLayout
inside of it and bind it to the AvaloniaList
System.InvalidOperationException: 'ItemsRepeater's child not found in its Children collection.'
Expected behavior
Scrolling should not make the 0th item in the collection disappear and crash the app.
Desktop (please complete the following information):
Additional context
I saw the same problems with XML in microsoft/microsoft-ui-xaml#2969 and microsoft/microsoft-ui-xaml#2834. Maybe that could help.
Describe the bug
Code behind for ItemsRepeater
page in the ControlCatalog supports switching to WrapLayout
. Somehow we lost XAML part that was actually listing this layout. But if you enable it, it will crash anyway.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No crashes due to WrapLayout
asking to be given all the space in universe.
Screenshots
Desktop (please complete the following information):
When a ItemsRepeater is inside a Viewbox the list of shown items doesn't take the Viewbox transformation into account (or at least not correctly). Not all of the items are drawn even though there is enough space due to the Viewbox.
To Reproduce
Minimal sample:
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:avalonia_showcase.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="avalonia_showcase.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Width="300"
Height="200"
Title="avalonia_showcase">
<Design.DataContext>
<vm:MainWindowViewModel/>
</Design.DataContext>
<Grid RowDefinitions="*,30" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Viewbox Grid.Row="0" Stretch="Uniform" StretchDirection="DownOnly">
<ItemsRepeater Items="{Binding Items}" >
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" Padding="5"/>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</Viewbox>
<Button Command="{Binding Add}" Content="Add" Grid.Row="1" HorizontalAlignment="Center"/>
</Grid>
</Window>
The viewmodel is simply a ObservableCollection
to which strings can be added with via the button:
using System.Collections.ObjectModel;
namespace avalonia_showcase.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
public ObservableCollection<string> Items { get; } = new ObservableCollection<string>();
public MainWindowViewModel()
{
Items.Add("abc");
Items.Add("def");
}
public void Add()
{
Items.Add("test 123");
}
}
}
Expected behavior
Since the whole ItemsRepeater is shrunken down to fit all of its content, I'd expect all of it to be visible.
Screenshots
Screencast from 2022-10-20 16-57-31 (trimmed).webm
Desktop (please complete the following information):
Describe the bug
ItemsRepeater shows the wrong item location when the data is large
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
DataTemplate adaptation is wrong in ItemsRepeater.
Reproduction project
https://github.com/YoshihiroIto/AvaloniaDataTemplateProblem
This project works as follows
Numbers below 100 are displayed in red.
Numbers above 100 are displayed in green.
When the Add Items button is clicked, 10 items are added.
When the Remove Items button is clicked, 10 items are removed.
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
<ItemsRepeater Items="{Binding Items}">
<ItemsRepeater.Layout>
<UniformGridLayout MinItemWidth="60" Orientation="Vertical" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<views:DataTemplateSelector>
<views:DataTemplateSelector.Under100DataTemplate>
<DataTemplate DataType="viewModels:DataViewModel">
<TextBlock
Width="60"
Foreground="Red"
Text="{Binding Index}" />
</DataTemplate>
</views:DataTemplateSelector.Under100DataTemplate>
<views:DataTemplateSelector.Over100DataTemplate>
<DataTemplate DataType="viewModels:DataViewModel">
<TextBlock
Width="60"
Foreground="Green"
Text="{Binding Index}" />
</DataTemplate>
</views:DataTemplateSelector.Over100DataTemplate>
</views:DataTemplateSelector>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
public class DataTemplateSelector : IDataTemplate
{
public IDataTemplate? Over100DataTemplate { get; set; }
public IDataTemplate? Under100DataTemplate { get; set; }
public IControl? Build(object? param)
{
if (param is not DataViewModel vm)
throw new NotSupportedException();
return vm.IsOver100
? Over100DataTemplate?.Build(param)
: Under100DataTemplate?.Build(param);
}
public bool Match(object? data)
{
return data is DataViewModel;
}
}
public class MainViewModel : ViewModelBase
{
public ObservableCollection<DataViewModel> Items { get; } = new();
public ReactiveCommand<Unit, Unit> AddItemsCommand { get; }
public ReactiveCommand<Unit, Unit> RemoveItemsCommand { get; }
public MainViewModel()
{
for (var i = 0; i != 200; ++i)
Items.Add(new DataViewModel { Index = Items.Count });
AddItemsCommand = ReactiveCommand.Create(() =>
{
for (var i = 0; i != 10; ++i)
Items.Add(new DataViewModel { Index = Items.Count });
}
);
RemoveItemsCommand = ReactiveCommand.Create(() =>
{
for (var i = 0; i != 10; ++i)
Items.RemoveAt(Items.Count - 1);
}
);
}
}
public class DataViewModel : ViewModelBase
{
public int Index
{
set
{
this.RaiseAndSetIfChanged(ref index, value);
this.RaisePropertyChanged(nameof(IsOver100));
this.RaisePropertyChanged(nameof(IsUnder100));
}
get => index;
}
public int index;
public bool IsOver100 => Index > 100;
public bool IsUnder100 => !IsOver100;
}
To Reproduce
After adding and deleting items several times, the colors are displayed incorrectly.
Expected behavior
After repeated addition and deletion of items, below 100 are displayed in red, and above 100 are displayed in green.
Screenshots
Desktop
OS: Windows 11
Avalonia: 11.0.0-preview1
Describe the bug
Some text will disappear when scrolling back to the previous elements in ItemsRepeater
To Reproduce
Expected behavior
Screenshots
Desktop (please complete the following information):
I have a personal app that uses ItemsRepeater to list multiple tv shows data. Before updating to Avalonia 11.0.10 everything was working fine regarding removing items from an observable list and the item updating in ItemsRepeater.
I'm also using CommunitToolkit.MVVM.
After the update to 11.0.10 the ItemsRepeater, apparently, loses context the item context and shows the content as it is not loaded.
When I resized the screen "refreshes" and everything item came back to normal.
This project run in windows and android, but the issue only happens in Windows.
So before came here I tried to replicate the issue, with a similar approach I was using a smaller sample project, but I couldn't replicate the issue.
So the project where the error happens is: (it's kinda big, idk if would help) https://github.com/adleywd/WhatsNextSeries/tree/feature/MigrateToDotNetAvalonia/src/WhatsNextSeries
The sample I tried to reproduce it (but I couldn't yet)
https://github.com/adleywd/AvaloniaItemsRepeaterSample
When an item is removed from an observable list, the ItemsRepeater should remove the item but keep the context of unmodified items.
Avalonia version
11.0.10
OS
Windows
Additional context
With the bug in Avalonia 11.0.10
After removing and item from the list, other Items go back to default value:
"Tv show name"
"Not available"
In the provided sample, I'm using an ItemsRepeater and a nested ItemsRepeater to create multiple toggle buttons. The sample also has 2 toggle buttons created in XAML directly. Tabbing through the items allows me to tab through the XAML generated toggle buttons until I reach the first toggle button created by the ItemsRepeater. I can't tab to the other items.
Some additional observations:
A simple repro case can be found here:
https://github.com/StefanKoell/Misc/tree/main/src/AvaTabKeyIssue
When tabbing through the UI, I expect that all controls (with IsTabStop set to true) show the white focus adorner to allow keyboard interaction. I would also expect to cycle through all the items and show the white focus adorner using the accelerator key when multiple identical keys are assigned.
https://github.com/AvaloniaUI/Avalonia/tree/repro-items-repeater-issue
simply run control catalog, there are numbered squares in the items repeater...
scroll slowly until the top row just disappears, notice that items repeater shifts the numbers.
Description
WrapLayout is not updating correctly when source collection is changed.
Consider an ItemsRepeater bound to a changing source collection "CurrentNode.Things".
With <UniformGridLayout />
the ItemsRepeater displays the correct items from "CurrentNode.Things" as CurrentNode changes.
If I change to <WrapLayout />
, the number of displayed items updates correctly, but any items from the previous source are displayed instead.
In the example below, the UniformGridLayout is left, and WrapLayout on the right...
To Reproduce
public class Thing
{
public string? Name { get; set; }
}
public class FolderNode
{
public ObservableCollection<Thing> Things { get; set; } = new ObservableCollection<Thing>();
public FolderNode(List<string> Names)
{
foreach (string c in Names)
{
Things.Add(new Thing { Name = c });
}
}
}
public class MainWindowViewModel : ViewModelBase
{
private FolderNode _currentNode = default!;
public FolderNode CurrentNode
{
get => _currentNode;
set
{
this.RaiseAndSetIfChanged(ref _currentNode, value);
}
}
ObservableCollection<FolderNode> Folders { get; set; } = new ObservableCollection<FolderNode>();
public ICommand SelectFolderCommand { get; }
public MainWindowViewModel()
{
Folders.Add(new FolderNode(new List<string>()));
Folders.Add(new FolderNode(new List<string>() { "A", "B" }));
Folders.Add(new FolderNode(new List<string>() { "D", "E", "F" }));
CurrentNode = Folders[0];
SelectFolderCommand = ReactiveCommand.Create<string>(param =>
{
CurrentNode = Folders[int.Parse(param)];
});
}
}
<Grid ColumnDefinitions="Auto,1*,1*">
<StackPanel Grid.Column="0">
<Button Command="{Binding Path=SelectFolderCommand}" CommandParameter="0">0</Button>
<Button Command="{Binding Path=SelectFolderCommand}" CommandParameter="1">2</Button>
<Button Command="{Binding Path=SelectFolderCommand}" CommandParameter="2">3</Button>
</StackPanel>
<ItemsRepeater Grid.Column="1" Items="{Binding Path=CurrentNode.Things}" Background="Bisque">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=Name}" HorizontalAlignment="Left" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
<ItemsRepeater.Layout>
<UniformGridLayout />
</ItemsRepeater.Layout>
</ItemsRepeater>
<ItemsRepeater Grid.Column="2" Items="{Binding Path=CurrentNode.Things}" Background="AliceBlue">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=Name}" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
<ItemsRepeater.Layout>
<WrapLayout />
</ItemsRepeater.Layout>
</ItemsRepeater>
</Grid>
Expected behavior
WrapLayout should display the correct items from source!
Desktop:
https://github.com/mike-ward/demoscroll
DemoScroll is a minimal Avalonia desktop application that demonstrates undesirable scrolling behavior.
What it does:
ItemsRepeater
ItemsRepeater
.What it demonstrates:
Desktop (please complete the following information):
Additional context
Related to AvaloniaUI/Avalonia#5151
Describe the bug
When nesting ItemsRepeaters, a couple things...
1- When scrolling, primarily with the scrollbar thumb, the garbage collector runs almost constantly. I can't tell if this occurs in WinUI since that mostly lives in native memory
2- When scrolling, especially large jumps quickly, the scrollviewer will freeze. Resizing a parent container (like the window) will fix it. I think this is related to the items of different height issue, but I haven't seen any reports of freezing yet. I also can't replicate this in WinUI, I can get choppy scrolling but it never fully freezes. Sometimes it takes aggressive scrolling to cause this (like in the video I attached), and sometimes one large quick scroll will do it.
(see attached video for demo of 1 & 2)
3- There may or may not be a memory leak. I do think this also occurs upstream in WinUI, as process memory slowly climbs when scrolling.
When first loaded, 10 ListBoxItems are present
Scroll up and down the list once: 179 ListBoxItems are present
Scroll randomly: 301
Scrolling some more: 438
To Reproduce
Example code:
Group installed fonts alphabetically and display using nested ItemsRepeaters
public class ViewModel
{
public ViewModel()
{
Items = new List<string>(FontManager.Current.GetInstalledFontFamilyNames());
var query = from item in Items
group item by item.Substring(0, 1).ToUpper() into g
orderby g.Key
select new GroupInfo(g) { Key = g.Key };
Groups = new List<GroupInfo>(query);
}
public List<string> Items { get; }
public List<GroupInfo> Groups { get; }
}
public class GroupInfo : List<string>
{
public string Key { get; set; }
public GroupInfo(IEnumerable<string> items) : base(items) { }
}
Window Content:
<Panel>
<Border Width="350" Height="400"
BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1">
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<ItemsRepeater Items="{Binding Groups}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<StackPanel>
<Border Height="40">
<TextBlock Text="{Binding Key}"
VerticalAlignment="Center"
Margin="12 0"
FontWeight="Bold"/>
</Border>
<ItemsRepeater Items="{Binding}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<ListBoxItem Height="40" Content="{Binding}" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</StackPanel>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
</Border>
</Panel>
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
https://user-images.githubusercontent.com/40413319/111887602-0ebf6c00-89a4-11eb-80c9-889c42d62ce5.mp4
Desktop (please complete the following information):
Describe the bug
On Debian Buster, when you use an ItemsRepeater inside of a ScrollViewer and start to scroll after a little while you get a segmentation fault error. This only occurs when using .net 6.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Ability to keep scrolling down and view all data without crashing.
Screenshots
No screenshots.
Desktop (please complete the following information):
Additional context
Does not occur on windows 10. Using the .net 5 sdk lets the program run normally as expected
Describe the bug
Using the ItemsRepeater
inside ScrollViewer
causes inconsistencies with DataContext
.
When I scroll to the end of the ScrollViewer
, or close to, the first few items' DataContext
becomes null,
and when going back up, it may get mixed around with other objects.
To Reproduce
Steps to reproduce the behavior:
ItemsRepeater
control inside ScrollViewer
and populateItemsRepeater
ScrollViewer
far enoughDataContext
of ItemsRepeater
Expected behavior
DataContext
is supposed to not become null, or get jumbled around.
Screenshots
Desktop (please complete the following information):
Additional context
Bug case minimal reproducible example
bug_case.zip
I have a grid of 2 columns and a grid splitter. The second column has an item repeater of borders. When resizing with the grid splitter the app throws a null exception.
ItemRepeaterBug.zip
`
<!-- GridSplitter for resizing -->
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Center" VerticalAlignment="Stretch" />
<!-- ItemsRepeater in the Second Column -->
<ItemsRepeater Name="ItemsRepeater" ItemsSource="{Binding Skills}" Grid.Column="2">
<ItemsRepeater.Layout>
<WrapLayout
Orientation="Horizontal"
VerticalSpacing="15"
HorizontalSpacing="15" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Black"
BorderThickness="2"
Background="{DynamicResource ArWhite}"
Height="80"
Width="70">
</Border>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</Grid>`
` public partial class MainViewModel : ViewModelBase
{
public ObservableCollection<int> Skills { get; } = new ObservableCollection<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
}`
No response
11.0.10
Windows
No response
Describe the bug
Your app slightly lags and you have an ItemsRepeater
in a ScrollViewer
. When you start scrolling down - there is a big chance of scroll resetting to 0 position.
To Reproduce
Steps to reproduce the behavior:
Sorry for not providing an example project with a repro - it's a lot of time to emulate this conditions.
Expected behavior
Scroll do not resets to 0 position.
Screenshots
We've attached a video
Desktop (please complete the following information):
Additional context
I've debugged deep. The bug is based on two behaviors:
ItemsRepeater
recycles elements by setting them position of another element, or -10k position if there is nothing to recycle.ScrollContentPresenter
saves the link to the anchor element and calculates everything from it. see TrackAnchor
local method.ScrollViewer
tries to set equally in invalid or even negative area.So to fix this I think ScrollContentPresenter
should check for anchor getting recycled.
I've temporarily fixed this by a hack in our app: If scroll is resets to zero without any point - I'm restoring old offset.
Describe the bug
Even with ~20 items, ItemsRepeater takes a few seconds to scroll.
To Reproduce
<DockPanel>
<TextBox
Name="SearchTextBox"
Margin="15,5,15,10"
Classes="clearButton"
DockPanel.Dock="Top"
Text="{Binding SearchTerm}"
Watermark="Filter" />
<ScrollViewer Padding="15,0">
<ItemsRepeater ItemsSource="{Binding Types}">
<ItemsRepeater.ItemTemplate>
<DataTemplate DataType="model:TypeExtract">
<controls:SettingsExpander
Margin="0,1"
Description="{Binding Namespace}"
Header="{Binding Name}" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
</DockPanel>
Desktop (please complete the following information):
Additional context
Debug output constantly shows
[Layout]Layout cycle detected. Item 'Avalonia.Controls.StackPanel' was enqueued '10' times.(LayoutQueue`1 #12819582)
[Layout]Layout cycle detected. Item 'Avalonia.Controls.TextBlock' was enqueued '10' times.(LayoutQueue`1 #12819582)
[Layout]Layout cycle detected. Item 'Avalonia.Controls.Presenters.ContentPresenter' was enqueued '10' times.(LayoutQueue`1 #12819582)
Describe the bug
When I have some items collection rendered using ItemsRepeater nested in ScrollView, and it's not visible due to being too low in the ScrollView, it does not render items after becoming visible when maximizing window.
If I do resize the window using window side handler, it does show up as expected.
To Reproduce
Expected behavior
I expect to see items right away after first window maximize.
Screenshots
Reproduction video:
https://user-images.githubusercontent.com/883587/202908113-89d0327c-1334-4bf7-b85f-9ea19d2807b9.mp4
Desktop (please complete the following information):
Additional context
I'm using 125% UI scaling and 2K display.
Originally posted by Mrcubix July 11, 2023
For some reasons, the selector :nth-last-child(1)
seems to only be evaluated properly at first, any additions done after the Window is shown will result in an incorrect behavior.
in this exemple, the last element is supposed to have a margin of 0, so that the scrollbar doesn't show up until another element is added.
the same behavior can be obtained using this repo: https://github.com/Mrcubix/Avalonia-Last-Nth-Child-Selector-Issue
Note that the orginal discussion was written in an earlier version, but the issue is still valid to this day
about the same styling works for ItemsControl
, however, ItemsControl
suffer from a worse issue explained here #12137
Describe the bug
ItemsRepeater have poor performance when it contains nested items repeaters.
There are also performance issues on large plain lists with emoji.
These videos are recorded in Release configuration (dotnet run -c Release
).
Here is my workstation configuration:
To Reproduce
demo.zip
Desktop (please complete the following information):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.