New to Telerik UI for WPF? Download free 30-day trial

Unbound Mode

There are scenarios, in which you might want to use the RadDataPager only for its UI without passing any data to it. This scenarios will require you to use the RadDataPager's Unbound Mode feature. The use of this feature consists in setting some of the RadDataPager's properties manually and handling a few events.

The example in this topic will show you a ListBox bound to a list of integers. A RadDataPager will be used as UI to page the data, but the paging itself will be done outside of the RadDataPager via LINQ extension methods.

Here is the XAML for the example. In it you can see a ListBox and a RadDataPager with its PageSize property set. The other important thing is the event handler attached to the PageIndexChanged event.

<Grid x:Name="LayoutRoot" 
        <RowDefinition /> 
        <RowDefinition Height="Auto" /> 
    <ListBox x:Name="listBox" /> 
    <telerik:RadDataPager x:Name="radDataPager" 
                            PageIndexChanged="radDataPager_PageIndexChanged" /> 

Now take a look at the code-behind. There is a simple list of integers, which will serve as a dummy data. The keypoints here are to set the ItemCount property of the DataPager to the count of your data. In this way the UI will display correct information to the user. The next point is to set the ItemsSource of the ListBox to an appropriate value and the last one is to implement the custom paging logic inside the handler for the PageIndexChanged event.

If you want to implement some logic before the PageIndex gets changed, you can attach an event handler to the PageIndexChanging event.

public partial class UnboundModeSample : UserControl 
    private List<int> data; 
    public UnboundModeSample() 
        InitializeComponent(); = Enumerable.Range( 0, 100 ).ToList(); 
        this.radDataPager.ItemCount = data.Count; 
        this.listBox.ItemsSource = this.radDataPager.PageSize ).ToList(); 
    private void radDataPager_PageIndexChanged( object sender, PageIndexChangedEventArgs e ) 
        if ( != null ) 
            this.listBox.ItemsSource = e.NewPageIndex * this.radDataPager.PageSize ).Take( this.radDataPager.PageSize ).ToList(); 
Public Partial Class UnboundModeSample 
 Inherits UserControl 
 Implements IView 
 Private data As List(Of Integer) 
 Public Sub New() 
  InitializeComponent() = Enumerable.Range(0, 100).ToList() 
  Me.radDataPager.ItemCount = data.Count 
  Me.listBox.ItemsSource = 
 End Sub 
 Private Sub radDataPager_PageIndexChanged(sender As Object, e As PageIndexChangedEventArgs) 
  If IsNot Nothing Then 
   Me.listBox.ItemsSource = * Me.radDataPager.PageSize).Take(Me.radDataPager.PageSize).ToList() 
  End If 
 End Sub 
End Class 

See Also

In this article