Since its introduction the RadDataBoundListBox has been constantly optimized and extended to bring the great UX it delivers today for WP7: both in terms of data processing and UX. It was clear from the beginning that UI virtualization brings great value for a fast performing Windows Phone 7 application but we had some further mighty plans for this control and now we can proudly demonstrate some early bits of a new, fully integrated mechanism for virtualizing data (yes, not only UI!).

What does this actually mean? Well, in a nutshell, data virtualization means that you do not need to download the whole list of data items in order to bind and visualize it in the RadDataBoundListBox but yet have it behave as if the whole data is initially loaded. Now you will be able to use a convenient API to simply download the data chunks that you need and nothing more. Actually the approach is so smart, that it automatically calculates which data items are currently to be shown in the viewport to the end user and requests them by providing the developer with a 2-tuple of index and count which unambiguously describe a single portion of data to be loaded. After having the data delivered (be it from a web service or a database) the developer simply needs to load it by providing the same 2-tuple information and an IEnumerable with the data items.

To visually support this behavior, the RadDataBoundListBox gets extended with functionality that allows for defining ItemLoadingTemplate. In other words, visual items that have not yet received their corresponding data item will have a specialized loading template informing the end user that data is expected. Just take a look at the screenshots of our MIX11 demo application that will bring this new functionality directly into your hands to test:


RadDataBoundListBox used with VirtualizingDataCollection


In order to set up all these goodies with your RadDataBoundListBox you will simply need to use the new VirtualizingDataCollection. Specifying the count of data items that are about to be loaded and handling the ItemsLoading event to know when and what data chunks to download is all you need to code. And here’s how:


private void OnSessions_ItemsLoading(object sender, VirtualizingDataCollectionItemsLoadingEventArgs e)
    int startIndex = e.StartIndex;
    int count = e.Count;
    this.LoadSessions(startIndex, count);
private void LoadSessions(int startIndex, int count)
    Uri loadUri = new Uri("/Sessions?$skip=" + startIndex + "&$top=" + count + "&$expand=Speakers&$orderby=StartTime", UriKind.Relative);
private void OnSessionsSource_LoadCompleted(object sender, LoadCompletedEventArgs e)
    if (e.Error != null)
        throw e.Error;
    this.sessions.LoadItems(this.GetStartIndexFromRequestUri(e.QueryOperationResponse.Query.RequestUri), this.sessionsSource);


The code above uses ODATA queries to fetch data chunks but the mechanism is not limited to this approach.
We are really excited about these new features that will give a further momentum to our data list controls (RadDataBoundListBox and RadJumpList). If you wish to have hands on experience of the early data virtualization bits find our booth @MIX11 in Las Vegas and use the keywords :-).

Related Posts


Comments are disabled in preview mode.