Automatic virtualization without odata?

9 posts, 0 answers
  1. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 14 Feb 2012 Link to this post

    I am using the Live Connect API (REST) for retrieving Skydrive photos and show them on a radListbox. To my understanding this API does not support odata, so how to connect data to the listbox?

    This is the behavior I am looking for:

    - Initial REST request 20 of 100 items --> Display and be ready to manipulate on listbox
    - Async: download the next 20 --> Append them to listbox without locking UI
    - Async: download the next 20 --> Append them to listbox without locking UI 
    - (so on...)

    I already have the deserialized data on a List<type>. How can I bind it to the listbox with automatic virtualization?
  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 15 Feb 2012 Link to this post

    Hello Jandieg,

    Thanks for writing.

    For this scenario the best approach would be to use the OnDemandAutomatic data virtualization mode exposed by RadDataBoundListBox. In this mode the control will fire an event each time the user scrolls near to the end of the scrollable list. You can use this event to further populate your data source with new data items and thus allow the user to continue scrolling and browsing the next items.

    We have a help article dedicated to this feature:

    http://www.telerik.com/help/windows-phone/raddataboundlistbox-features-datavirtualization-ondemandautomatic.html

    We also have a couple of nice examples (source code available) in our Demos Application that you can download as a Visual Studio Solution from the Downloads section of your account. Take a look at the OnDemand example of RadDataBoundListBox where the same scenario is implemented.

    I hope this helps.

    Let me know if you have further questions or need assistance.

    All the best,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 15 Feb 2012 Link to this post

    Indeed I tried that, over your samples. But the issue is that if I don't use DataServiceXxx classes, whenever I add items to the listbox it locks the UI and makes scrolling to hiccup.
    I have the data on a List<> (could also be observablecollection<>), do you have any samples using these kind of data sources?
  5. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 15 Feb 2012 Link to this post

    Hi Jandieg,

    RadDataBoundListBox uses the off-thread Manipulation approach to boost scrolling performance so you should not experience any performance issues when the UI thread is locked. However, I presume you are talking about the asynchronous way the DataServiceXxx collections download data that is different compared to other approaches. This however, is functionality that depends on the way you have implemented the data downloading in your app, RadDataBoundListBox does not handle this. It simply visualizes the data and tells you when to fetch new portion of it from your source, be it a Web Service or a local collection.

    As for using List<T> or ObservableCollection<T> with RadDataBoundListBox: it simply does not matter what your source collection is. If you are using ObservableCollection<T> you can add the first 20 items you want to display and when you receive the DataRequested event you should download the next 20 and append them to your ObservableCollection when they come.

    As you may have already seen, our examples that use the OnDemand functionality do not really use the DataService classes as a source. They are simply used to fetch data from a webservice. We have an ObservableCollection that is bound to the ItemsSource property of the control and fill this collection on the UI thread with the data that has been fetched from the Web Service asynchronously.

    In case you think I do not completely understand your scenario, I would recommend you to prepare a sample project where you demonstrate the case so that I can directly take a look and see how I can help.

    In order to attach files you should open a new support ticket.

    Thanks for your time.

    All the best,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 15 Feb 2012 Link to this post

    I think I am getting it, will code some and let you know anything.
  7. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 15 Feb 2012 Link to this post

    Ok its working I think... just doubting if this would cause any loading performance:

    Dispatcher.BeginInvoke(() =>
                {
                    this.sessions.LoadItems(index, lst);
                });

    I have to do it that way since inside an async callback... Its ok?
  8. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 16 Feb 2012 Link to this post

    Hello Jandieg,

    Using a Dispatcher is completely OK. This will postpone the execution of the code put in there and thus the UI thread will be kept free at the moment of calling the Dispatcher.

    Let me know if you have further questions or need assistance.

    Greetings,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  9. Jandieg
    Jandieg avatar
    43 posts
    Member since:
    Feb 2012

    Posted 16 Feb 2012 Link to this post

    Thanks. Got it working.
    Now only waiting for the multicolumn. Where to subscribe to beta?
    Is there any temporal tweak/workaround to achieve it?
  10. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 16 Feb 2012 Link to this post

    Hello Jandieg,

    Our official Q1 2012 release that contains the Wrap Mode functionality is already online. Check out the announcement blog that gives further details on the release:

    http://blogs.telerik.com/deyanginev/posts/12-02-16/announcing-radcontrols-for-windows-phone-q1-2012.aspx

    Please note that the Wrap Mode for RadDataBoundListBox has been released as Beta so that we can gather some feedback from developers and thus be able to polish it and fix issues that might be present.

    As for the Wrap Mode, you can take a look at our online help for some tips & tricks on how to use it:

    http://www.telerik.com/help/windows-phone/raddataboundlistbox-features-virtualizationstrategies.html

    Kind regards,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
DevCraft banner