RadDataPager - Requirement for Previous and Back button to be enabled Always

6 posts, 0 answers
  1. Jai
    Jai avatar
    14 posts
    Member since:
    Feb 2017

    Posted 03 Apr Link to this post

    Hi ,
    I have a requirement of Infinite paging,
    Where I want both previous and next button to get navigate to last and first page respectively.
    Navigating to first page on click of Next page button When user is on last page can be achieved by setting IsTotalItemCountFixed = false
    But how to have previous page button navigate to the last page When User is on the First page of the Grid ?
    Any assistance would be a great help :)
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1189 posts

    Posted 04 Apr Link to this post

    Hi,

    RadDataPager uses a concrete implementation of the IPagedCollectionView interface as paged source. The default one is Telerik.Windows.Data.QueryableCollectionView. In this way, clicking the buttons invokes commands that call the MoveTo... methods. To override this behavior (e.x. move from first to last by invoking MoveToPrevious), you will need a custom implementation of IPagedCollectionView and ICollectionView, whch should be passed as RadDataPager.Source value.

    Regards,
    Ivan Ivanov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Jai
    Jai avatar
    14 posts
    Member since:
    Feb 2017

    Posted 05 Apr in reply to Ivan Ivanov Link to this post

    Hi Ivan,

    Thank you for the quick response.

    But We also need to enable the previous button of Raddatapager i.e. it should get clicked to execute the custom implementation of IPagedCollectionView and ICollectionView.

    So basically our requirement is to enable the previous button of raddatapager to get clicked.

    Any Tweak to solve this one will be grateful.

  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1189 posts

    Posted 06 Apr Link to this post

    Hi,

    The buttons invoke the MoveTo... methods and the buttons themselves get enabled in accordance to the results of the CanMoveTo properties. They are registered as read-only dependencies properties, so that they cannot be modified through the public API. Their implementation relies on IPagedCollectionView.CanChangePage. However, making it always return true will not be enough as they also rely of IPagedCollectionView.PageIndex. For instance CanMoveToFirstPage is calculated like this:

    if (this.CanChangePage)
                    {
                        return this.PageIndex > 0;
                    }
                     
                    return false;
    You can find the implementation of all the CanMoveTo... methods is our source code, in the DataPagerViewModel class.

    Regards,
    Ivan Ivanov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Jai
    Jai avatar
    14 posts
    Member since:
    Feb 2017

    Posted 09 May in reply to Ivan Ivanov Link to this post

    Hi Ivan,

    It will be grateful If you can give an example for the above case where on click of previous button i can navigate to last page.

  6. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1189 posts

    Posted 12 May Link to this post

    Hi,

    I will try to prepare a sample project and I will post it here as soon as I have it.

    Regards,
    Ivan Ivanov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top