This is a migrated thread and some comments may be shown as answers.

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

5 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jai
Top achievements
Rank 1
Jai asked on 04 Apr 2017, 04:41 AM
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 :)

5 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 04 Apr 2017, 04:01 PM
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.
0
Jai
Top achievements
Rank 1
answered on 06 Apr 2017, 04:59 AM

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.

0
Ivan Ivanov
Telerik team
answered on 06 Apr 2017, 05:05 PM
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.
0
Jai
Top achievements
Rank 1
answered on 09 May 2017, 10:53 AM

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.

0
Ivan Ivanov
Telerik team
answered on 12 May 2017, 10:36 AM
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.
Tags
General Discussions
Asked by
Jai
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Jai
Top achievements
Rank 1
Share this question
or