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

6 posts, 0 answers
  1. Sascha
    Sascha avatar
    13 posts
    Member since:
    Jan 2017

    Posted 28 Jan 2017 Link to this post

    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?

  2. Tsvyatko
    Admin
    Tsvyatko avatar
    863 posts

    Posted 01 Feb 2017 Link to this post

    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
  3. Sascha
    Sascha avatar
    13 posts
    Member since:
    Jan 2017

    Posted 01 Feb 2017 Link to this post

    Hi Tsvyatko,

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

    Thanks.

  4. Tsvyatko
    Admin
    Tsvyatko avatar
    863 posts

    Posted 06 Feb 2017 Link to this post

    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
  5. Sascha
    Sascha avatar
    13 posts
    Member since:
    Jan 2017

    Posted 06 Feb 2017 in reply to Tsvyatko Link to this post

    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

  6. Tsvyatko
    Admin
    Tsvyatko avatar
    863 posts

    Posted 09 Feb 2017 Link to this post

    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
Back to Top