Changing the ItemsSource property of the ListView causes it to recreate its cells. The problem is that the existing cells are never reclaimed by the garbage collector, so the memory usage grows constantly. Eventually, the application can run out of memory, if the ItemsSource is updated too many times.
Note: It is possible the memory leak is caused by the bindings holding objects longer than necessary. Similar memory leaks can be reproduced with the .NET MAUI CollectionView as well. Here are a few GitHub issues for the CollectionView that might be related:
When having a nested grid layouts with auto and definitive row heights, the content in the ListView ItemTemplate is not property sized only on iOS. On Android, MacCatalyst and WinUI the content is property sized.
Solution:
1. Using only auto-sized grid rows,
2. Using grouping and simplifying the layout, removing nested grid layouts, and using a vertical stack.
Hi Team,
Please expose the ScrollViewer, or expose a method on the RadListView that allows the developer to set a Y device-independent vertical position. Setting the Y value will trigger the internal/native scrollview to go to that position without any special animations or manipulation. Just a pure position set.
I need to be able to programmatically scroll to a specific position in the list. Yes, I am aware of the ScrollToItem methods, however that will not work in my case as I explicitly need the Y position (for acceleration and manipulation of the exact position).
As an example, here's how I am currently doing it for a ScrollView:
private async Task AutoScrollAsync()
{
while (!(this.ScrollVelocity == 0 || this.ScrollVelocity > 0 && this.IsScrolledToBottom() || this.ScrollVelocity < 0 && this.IsScrolledToTop()))
{
await this.scrollView.ScrollToAsync(0, this.CalculateNextScrollY(), false);
await Task.Delay(ScrollDelay);
}
this.StopScrolling();
}
I am hoping to be able to do the same thing for the RadListView.
Thank you,
Aaron
The bug can be reproduced quite easily with the SDK examples. Choose any ListView example from the LoadOnDemand category that uses LoadOnDemandMode set to Automatic, e.g. ListView/LoadOnDemand/LoadOnDemandEvent. Remove the initial items from the ItemsSource:
public ViewModel()
{
this.Source = new ObservableCollection<string>();
//for (int i = 0; i < 14; i++)
//{
// this.Source.Add(string.Format("Item {0}", i));
//}
this.LoadItemsCommand = new Command(this.LoadItemsCommandExecute);
}
Run the example to observe the exception almost immediately.
windows device with touch capabilities/monitor with touch -> the listview swipes and shows the swipe template, however pressing the button in the swipe or attempting to close the swipe makes the swipe content disappear and the entry to remain in the swiped position.Also multiple swipes are allowed. The swipe cannot be ended, etc.
Using the mouse - > swiping works as expected.
The bug occurs on Android when removing an item from a group and using sticky group headers.
Hi Team,
When I use a RadEntry or Entry in the RadListView, it is fine when rendering flat data. However, when the items are grouped, the app has a native WinUI unhandled exception (that needs a 2nd instance of VS2022 to catch).
The only way to stop it was to not use an entry-like control like a Label.
Here is code to reproduce it, I've attached a runnable example
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:telerik="clr-namespace:Telerik.Maui.Controls;assembly=Telerik.Maui.Controls"
xmlns:telerikDataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.Maui.Controls.Compatibility"
xmlns:telerikListView="clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.Maui.Controls.Compatibility"
x:Class="EntryTests.MainPage">
<Grid>
<telerikDataControls:RadListView x:Name="rulesListView"
ItemsSource="{Binding Clients}"
VerticalScrollBarVisibility="Always">
<telerikDataControls:RadListView.GroupDescriptors>
<telerikListView:PropertyGroupDescriptor PropertyName="Username" />
</telerikDataControls:RadListView.GroupDescriptors>
<telerikDataControls:RadListView.ItemTemplate>
<DataTemplate>
<telerikListView:ListViewTemplateCell>
<!-- WORKS -->
<!--<Label Text="{Binding Username}" FontSize="14"/>-->
<!-- HARD CRASH -->
<telerik:RadEntry Text="{Binding Username}" FontSize="14" />
</telerikListView:ListViewTemplateCell>
</DataTemplate>
</telerikDataControls:RadListView.ItemTemplate>
</telerikDataControls:RadListView>
</Grid>
</ContentPage>
Version Note: The repro app is using UI for MAUI v0.9.0 because it was tested by Lance McCarthy with both 0.8.0 and 0.9.0 (this 0.9.0 was built on May 11th).
There is a slow performance when scrolling, expand/collapse items when the ListView Groups are sticky and GroupHeaderTemplate is used.
Workaround:
1. Set IsGroupHeaderStickty to false.
or
2.. Use the default group header template
public class City
{
public string Name { get; set; }
public string Country { get; set; }
public Image CountryFlag { get; set; }
}