This is a migrated thread and some comments may be shown as answers.

Trying to understand virtualisation in RadListView (Xamarin.Forms iOS)

5 Answers 95 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Sascha
Top achievements
Rank 1
Sascha asked on 28 Jan 2017, 09:25 AM

Hello,

 

i am trying to understand the virtualisation technique in RadListView.

I am having a List with 30 Elements. 4 Elements are displayed at once.

I have a timer, that updates each item every minute. This update is rather slow but calculation is fast.

For each view model of those elements i raise one property changed event.

 

I hooked into the ListViewRenderer

public class ListViewExRenderer : ListViewRenderer
{
    protected override NSObject CreateDataSource(RadListView radListView)
    {
        return new ListViewExDataSource(radListView);
    }
 
    class ListViewExDataSource : ListViewDataSource
    {
        public ListViewExDataSource(RadListView view)
            : base(view)
        {
        }
 
        protected override TelerikUI.TKListViewCell CreateCellForItem(TelerikUI.TKListView listView, NSIndexPath indexPath, NSObject obj)
        {
            return base.CreateCellForItem(listView, indexPath, obj);
        }
    }
}

 

I set a breakpoint in CreateCellForItem. This is hit 30 times at the beginning, for all elements in the list. Then, it is hit again 4 times for the first items to be displayed. This is rather odd. I thought it would hit 4 times, and when i started scrolling, it would hit again for items that appearing. Any thoughts?

5 Answers, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 01 Feb 2017, 07:22 AM
Hi Sascha,

By default the listview realizes items to fill the listview length and then some additional buffer items. Usually, when all listview items are realized it is placed inside a container that forces to measure with infinity (e.g. StackLayout). Would it be possible to check if this is the case and whether the UI can be modified so that it does not forces infinity  measurement. 

Let us know if this helps.

Regards,
Tsvyatko
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sascha
Top achievements
Rank 1
answered on 01 Feb 2017, 06:35 PM

Hi Tsvyatko,

yes, it is a StackLayout, but i gave it a fixed HeightRequest. Is Grid better?

Thanks.

0
Tsvyatko
Telerik team
answered on 06 Feb 2017, 10:59 AM
Hi Sasha,

Generally Grid layout plays better with UI virtualized controls. However, we will investigate the exact behavior using stacklayout with height request to improve it in future versions. Would it possible to share some additional information on the xaml layout in which the listview is nested, so we can look into it?

Regards,
Tsvyatko
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sascha
Top achievements
Rank 1
answered on 06 Feb 2017, 11:12 AM

Hi Tsvyatko,

sure, i uploaded a POC to Github. You'll find it here. https://github.com/esskar/TelerikListViewPoc

It is not even XAML, but a Layout from Code: https://github.com/esskar/TelerikListViewPoc/blob/master/TelerikListViewPoc/Controls/BookListCell.cs

As you may notice, there are several problems broke with the ListView on iOS. I opened several issues here in the forum.

 

Thanks and Cheers,

Sascha

0
Tsvyatko
Telerik team
answered on 09 Feb 2017, 11:52 AM
Hello Sasha,

Thank you far sharing this setup. We will investigate it for potential issues and will address them in the upcoming minor builds.


P.S. I have updated your telerik points accordingly.

Regards,
Tsvyatko
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Sascha
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Sascha
Top achievements
Rank 1
Share this question
or