Binding to an ObservableCollection with custom paging

7 posts, 0 answers
  1. Ian
    Ian avatar
    17 posts
    Member since:
    Oct 2010

    Posted 29 Nov 2011 Link to this post

    Hi,

    I have created an app that uses the standard WP7 listbox control bound to an ObservableCollection of item view models.

    I have also implemented custom paging where new items are added to the collection when the user reaches the bottom of the current list.

    Functionally, this all works really well. However, I have an issue with the UI performance when the items are being drawn/bound to the control. The UI locks and stutters until the items appear on screen.

    This is when I decided to convert to a Telerik DataBoundListBox to try an improve performance. I simply changed my XAML and set the properties AsyncBalanceMode="Standard" and IsAsyncBalanceEnabled="True".

    This immediately gives a noticeable increase in performance which is great, but I just have one issue.  When the custom paging is triggered, and new items are appended to the collection, the list returns to the first item in the UI. This causes the user to have to scroll down to find the new items that have just been added.

    Is there a solution you can suggest to avoid this? I would love to achieve this without having to change my whole paging logic that already exists!

    Many thanks
    Ian
  2. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 30 Nov 2011 Link to this post

    Hello Ian,

    Thanks for contacting us.

    Interestingly, we are not aware of similar issue in RadDataBoundListBox. It seems that having all visual items return to the first one in the data list is an issue that is specific to your particular scenario.

    We are willing to help you and therefore we will be very thankful if you manage to prepare a sample application that reproduces the issue and send it to us. In this way we will be able to directly take a look at the problem. Please note that you will have to open a new support ticket in order to be able to attach your project.

    You may also find useful taking a look at this blog post which implements paging scenario using RadDataBoundListBox

    http://blogs.telerik.com/deyanginev/posts/11-06-10/implementing-data-paging-with-raddataboundlistbox-and-the-ondemandmanual-data-virtualization-mode.aspx

    Do not hesitate to write back anytime you have further questions or need assistance.

    Kind regards,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Ian
    Ian avatar
    17 posts
    Member since:
    Oct 2010

    Posted 30 Nov 2011 Link to this post

    Hi Deyen,

    Thank you for your response.  I created a small project to replicate the problem, and, lo and behold, I couldn't replicate it!

    I therefore started doing some investigation into my own code, and tracked down the problem to a collection extension that was being used. The DataBoundListBox was nothing to do with the issue!  I have now solved this issue and the list exhibits much better performance.

    Thanks again for your time.

    Regards
    Ian
  5. ellic
    ellic avatar
    16 posts
    Member since:
    Oct 2011

    Posted 07 Apr 2012 Link to this post

    Hi, lan

    I've also come up against this problem. When added some new data into the DataBoundListBox, the DataBoundListBox scrolled top automatically, cound you tell me what's the problem ?

    Thanks in advance.
  6. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 09 Apr 2012 Link to this post

    Hi Ellic,

    In similar cases a common reason is a reset of the items source of the list box. Make sure that when you're adding new items to the collection so that they're visualized in the list box you're not resetting the ItemsSource.

    I hope this helps.

    Greetings,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Mikael
    Mikael avatar
    10 posts
    Member since:
    Jun 2012

    Posted 18 Nov 2012 Link to this post

    I encountered this same issue when using the BindableCollection from the Caliburn.Micro as the ItemSource and calling its AddRange-method. If I use foreach & add for the new items, the control works as expected (scrollbar doesn't jump back to top) but if instead of foreach I just call AddRange, the control jumps back to top.

    I suppose this is because the BindableCollection raises the CollectionChanged event with argument NotifyCollectionChangedAction.Reset? It would be great to get the AddRange and the DataBoundListBox to work correctly together for the maximum performance so I wonder if anyone has any ideas on how to resolve this?
  8. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 19 Nov 2012 Link to this post

    Hi Mikael,

    Thanks for writing.

    As discussed in this thread, the issue here is related to the AddRange implementation in Caliburn. It practically resets the collection which makes the RadDataBoundListBox scroll back to the top position as it assumes that a new source collection has been provided. As you may now, there is no support for AddRange on Windows Phone and any custom implementation, like the one in Caliburn, would require custom logic in our controls to support it since there are no unified classes and interfaces that can be used.

    My suggestion here is to add the new items by using the Add method of the collection.

    Regards,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner