DataPager.Source Property


Gets or sets the data collection that the DataPager controls paging for.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

public IEnumerable Source { get; set; }
<sdk:DataPager Source="bindingDeclaration"/>
<sdk:DataPager Source="resourceReferenceToIEnumerable"/>

XAML Values


A Binding declaration using a {Binding ....} markup extension. For more information, see Binding Markup Extension or Binding.


A resource reference to an existing object of type IEnumerable from a resources collection. The resource reference must specify the desired IEnumerable by key.

Property Value

Type: System.Collections.IEnumerable
The data collection associated with this pager control.

Dependency property identifier field: SourceProperty

The source can be any IEnumerable collection. When bound to an IEnumerable that does not implement IPagedCollectionView, the DataPager behaves as if all the data is on a single page. Setting DataPager properties will not have any effect on the control.

Typically, the source is a collection that implements IPagedCollectionView. The IPagedCollectionView provides paging functionality, and the DataPager control provides a user interface for interacting with the IPagedCollectionView. To provide paging functionality for an IEnumerable collection, you can wrap it in the PagedCollectionView class.

The following code example demonstrates how to use a PagedCollectionView as the data source for a DataPager control. The List<T> that stores the data is wrapped in a PagedCollectionView, which provides paging functionality. Both the DataPager and the ListBox that displays the data use the PagedCollectionView as their data source. This example is part of a larger example available in the DataPager class overview.

Run this sample

List<String> itemList = new List<String>();
// Generate some items to add to the list.
for (int i = 1; i <= 33; i++)
    System.Text.StringBuilder sb = new System.Text.StringBuilder("Item ");
// Wrap the itemList in a PagedCollectionView for paging functionality
PagedCollectionView itemListView = new PagedCollectionView(itemList);

// Set the DataPager and ListBox to the same data source.
dataPager1.Source = itemListView;
listBox1.ItemsSource = itemListView;


Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions