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

Binding to an ObservableCollection with custom paging

6 Answers 170 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ian
Top achievements
Rank 1
Ian asked on 29 Nov 2011, 12:34 PM
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

6 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 30 Nov 2011, 02:06 PM
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 >>

0
Ian
Top achievements
Rank 1
answered on 30 Nov 2011, 06:20 PM
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
0
ellic
Top achievements
Rank 1
answered on 07 Apr 2012, 05:30 PM
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.
0
Deyan
Telerik team
answered on 09 Apr 2012, 12:05 PM
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 >>

0
Mikael
Top achievements
Rank 1
answered on 18 Nov 2012, 06:31 AM
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?
0
Deyan
Telerik team
answered on 19 Nov 2012, 08:01 AM
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.
Tags
DataBoundListBox
Asked by
Ian
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Ian
Top achievements
Rank 1
ellic
Top achievements
Rank 1
Mikael
Top achievements
Rank 1
Share this question
or