-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemsRepeater flicker when we data-bind the visibility of the items #16771
Comments
I can try another fix though |
Eh eh no it was only to have an issue to track my time ... but since I now found the root cause I can rename it and add details :) |
This needs a more detailed information. // in sample constructor:
ir.DataContext = Enumerable.Range(0, 1000).Select(i => new VM(i.ToString(), i % 2 == 0)).ToList();
public class VM
{
private string value;
private bool isVisible;
public VM(string value, bool isVisible)
{
this.value = value;
this.isVisible = isVisible;
}
public string Value => value;
public bool IsVisible => isVisible;
} <ScrollViewer Height="400">
<ItemsRepeater x:Name="ir" ItemsSource="{Binding}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Border Visibility="{Binding IsVisible}">
<TextBlock Text="{Binding Value}" />
</Border>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer> However, there is some extreme corruption happening. Reported in #16992 |
That's what I call "flicker" since it's when you scroll (depending of the scroll direction you will be able to see some items or not). Closing #16992 as duplicate of this. Edit: Feel free to rename this issue if you find it not descriptive enough ;) |
Current behavior
When we have a view like this:
Note the binding on
Visiblity="{Binding IsVisible}"
on theTextBlock
.This cause some flicker when scrolling, especially if there are nested
ItemsRepeater
doing the same!Expected behavior
No flicker and proper alignment of items!
How to reproduce it (as minimally and precisely as possible)
Workaround
DO NOT Data-bind the visibility of items, instead remove and add them back to the
MySource
collection.*************************** IMPORTANT ***************************
The "workaround" is actually the recommended way to do as it is (significantly) more performant as:
Works on UWP/WinUI
None
NuGet package version(s)
5.2
Affected platforms
Uno ... but the issue might be the same on windows and should be tested first!
The text was updated successfully, but these errors were encountered: