RadDataPager with ListBox

3 posts, 1 answers
  1. Yu
    Yu avatar
    18 posts
    Member since:
    Aug 2011

    Posted 23 Dec 2011 Link to this post

                <ListBox Name="itemsControl" ItemsSource="{Binding PagedSource, ElementName=radDataPager}"/>
                <telerik:RadDataPager Name="radDataPager" Height="30" VerticalAlignment="Bottom"
                   Source="{Binding myItemsSource}"
                List<string> list = new List<string>();
                for (int i = 0; i < 36; i++)
                this.radDataPager.Source = list;

    Now I got a problem that using ListBox with RadDataPager,When turn the lastpage to previouspage(for example,the last page only have 1 item),the previouspage's itemcount turn to 1,how could I fix that?Here is a demo code above,with telerik 2010 Q2,Thanks.


    Best Wishes,


  2. Answer
    Pavel Pavlov
    Pavel Pavlov avatar
    2039 posts

    Posted 28 Dec 2011 Link to this post

    Hi Yu Sky,

    It seems you have hit a bug in the ListBox . I have double checked for a problem in  our RadDataPager , but it appears an issue with the ListBox.
    To check this , you can add a simple TextBlock bound to the count of the paged source. You will definitely see it shows the correct count,

    Now the solution :

    You may subscribe to the PageIndexChanged  event of RadDataPager and reset the source of the list box inside the event handler , such as :

        this.radDataPager.PageIndexChanged += new EventHandler<Telerik.Windows.Controls.PageIndexChangedEventArgs>(radDataPager_PageIndexChanged);
    void radDataPager_PageIndexChanged(object sender, Telerik.Windows.Controls.PageIndexChangedEventArgs e)
        var cachedSource = this.itemsControl.ItemsSource;
        this.itemsControl.ItemsSource = null;
        this.itemsControl.ItemsSource = cachedSource;

    All the best,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
  4. Yu
    Yu avatar
    18 posts
    Member since:
    Aug 2011

    Posted 29 Dec 2011 Link to this post

    Hi Pavel,
    Thanks for reply! Is this because of the ItemSource has not refreshed when the page index has changed? This works,thanks.

    Best Wishes to Telerik Team,
Back to Top