Telerik UI for Windows Phone by Progress

The Automatic virtualization mode must be used in context with an instance of the VirtualizingDataCollection class. In this mode, only some portions of data items are loaded according to the current scroll position of the scrollable list in the control. When the end-user scrolls to another position, a new portion of data items is requested so that the view-port of the RadDataBoundListBox is correctly filled with data. When data is not available for the items currently visible in the control's view-port, a specialized content and template are used to indicate this. You can define these by setting the ItemLoadingContent and ItemLoadingTemplate properties exposed by RadDataBoundListBox. Once the data is available for these items the standard template logic is applicable.

To use the Automaticdata virtualization mode you need to:

  1. Set the DataVirtualizationMode property to DataVirtualizationMode.Automatic
  2. Set an instance of the VirtualizingDataCollection as an ItemsSource of the RadDataBoundListBox
  3. Handle the VirtualizingDataCollection.ItemsLoading event to request data items
  4. Use the VirtualizingDataCollection.LoadItems method to load the already available data items
If the ItemsSource property is initialized with a collection which is not a VirtualizingDataCollection an exception will be thrown.
If the DataVirtualizationMode property is set to Automatic and the ItemsSource is initialized with a collection different from VirtualizingDataCollection an exception will be thrown.

When using the Automaticdata virtualization mode you do not need to keep track of which items have been loaded since the VirtualizingDataCollection will do this for you. It will internally cache the already loaded items and will automatically calculate which indexes remain to be loaded.

The code snippet below demonstrates a simple scenario which utilizes the Automaticdata virtualization mode of the RadDataBoundListBox control. The ODATA client API is used to fetch data from a remove server:

private VirtualizingDataCollection sessions;
private DataServiceContext sessionsDataService;
private DataServiceCollection<Session> sessionsSource;
private bool requestIssued = false;

public void Init()
this.radDataBoundListBox1.DataVirtualizationMode =
this.sessions = new VirtualizingDataCollection(125, 10);
this.sessionsDataService = new DataServiceContext(new Uri("));
this.sessionsSource = new DataServiceCollection<Session>(this.sessionsDataService);
this.sessions.ItemsLoading += this.OnSessions_ItemsLoading;
this.sessionsSource.LoadCompleted += this.OnSessionsSource_LoadCompleted;
this.radDataBoundListBox1.ItemsSource = this.sessions;

private void OnSessions_ItemsLoading(object sender, VirtualizingDataCollectionItemsLoadingEventArgs e)
if (this.requestIssued)
int startIndex = e.StartIndex;
int count = e.Count;
this.LoadSessions(startIndex, count);
this.requestIssued = true;

private void LoadSessions(int startIndex, int count)
if (NetworkInterface.GetIsNetworkAvailable())
Uri loadUri = new Uri("/Sessions?$skip=" + startIndex + "&$top=" + count
+ "&$expand=Speakers&$orderby=StartTime", UriKind.Relative);
this.Dispatcher.BeginInvoke(() =>
this.radDataBoundListBox.ItemsSource = null;
MessageBox.Show("No Internet connection. This
example needs Internet access to function properly.");

private void OnSessionsSource_LoadCompleted(object sender, LoadCompletedEventArgs e)
if (e.Error != null)
MessageBox.Show("It seems that there is no Internet connection. This
example needs to connect to the Internet in order to function properly.");
this.requestIssued = false;
int startIndex = this.GetStartIndexFromRequestUri(e.QueryOperationResponse.Query.RequestUri);
this.sessions.LoadItems(startIndex, this.sessionsSource);

private int GetStartIndexFromRequestUri(Uri requestUri)
string uriString = requestUri.AbsoluteUri;
string skipArgument = "$skip=";
string topArgument = "&$top=";
int indexOfSkipArgument = uriString.IndexOf(skipArgument);
int indexOfTopArgument = uriString.IndexOf(topArgument);
int lengthOfSkip = skipArgument.Length;
return int.Parse(uriString.Substring(indexOfSkipArgument + lengthOfSkip, indexOfTopArgument - (indexOfSkipArgument + lengthOfSkip)));