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

SelectedPageChanging vs PageIndexChanging

2 Answers 285 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Adam P
Top achievements
Rank 2
Adam P asked on 16 Aug 2014, 07:03 AM
Hello, I just wanted to know if there is any difference between the SelectedPageChanging and PageIndexChanging events.  I can't think of a single scenario where one would be used but not the other. 

Is there one that is suggested over the other? 

Is one deprecated but not the other? 

Thanks

PS, see attached screenshot - looks like some API Documentation may need some updating...

2 Answers, 1 is accepted

Sort by
0
Adam P
Top achievements
Rank 2
answered on 16 Aug 2014, 10:07 AM
One thing that's kind of annoying - SelectedPageChanging uses RadPageViewCancelEventArgs.  These eventargs have a Page and Cancel property. 

Does the Page represent the page you're changing to or from?

The documentation doesn't say at all.  In fact it's wrong and says it is fired after it's changed, but I believe it fires before it changes (when it's changing).

http://www.telerik.com/help/winforms/e_telerik_wincontrols_ui_radpageview_selectedpagechanging.html

PageIndexChanging uses RadPageViewIndexChangingEventArgs  which has CurrentIndex and NewIndex (plus this questionable "Page" property), two geniusly named properties that don't even require me to read the docs.  And if it did - at least the docs tell me my answer ... =)

http://www.telerik.com/help/winforms/allmembers_t_telerik_wincontrols_ui_radpageviewindexchangingeventargs.html
0
Stefan
Telerik team
answered on 19 Aug 2014, 11:37 AM
Hello Adam,

Thank you for writing.

The SelectedPageChanging event will be fired, when the currently active page in RadPageView is being changed. For example when you click the tab of another page to activate it or when you set the SelectedPage property of the control. The Page in the event arguments will provide the page you are changing to. The currently selected page can be accessed via the SelectedPage property of the control.

The PageIndexChaning event will be fired, when a page in the Pages collection changes its index. For example if you insert some page or swap pages. The CurrentIndex and the NewIndex will tell you which was the index the Page was, and which is the NewIndex the page will have.

So these events cover different cases.

Note taken about the API description. I have updated your Telerik Points for this report.

I hope that this clear things up. Let me know if you have any additional questions regarding this matter.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
PageView
Asked by
Adam P
Top achievements
Rank 2
Answers by
Adam P
Top achievements
Rank 2
Stefan
Telerik team
Share this question
or