How can I handle the OnNext event?

Wizard for WPF Forum

Posted 18 years ago by Ray Huger
Version: 2.0.0321
Avatar
There does not seem to be an OnNext event for the Wizard even though one exists for Finish, Cancle, and Help. How should this event be handled?

For example, I would like know when the user clicks the next button so that I may update the state of the wizard based off the input on the current page. I do not care what the current page is or next page because I am simple enabling or disabling each page based of the state of the wizard to get the desired path I want. The idea is that as long as the pages are in order in the xaml and the wizard knows to skip disabled pages, I can change the path the wizard takes by enabling and disabling pages. This requires that I do the enabling before the wizard decides which page should be next when the next button is clicked. Is there an event that will allow me to do this?

Any help is greatly appreciated.
Thanks.

Comments (8)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ray,

You can handle the SelectedPageChanged event. That event's arguments has a SelectionFlags property. If that flags property contains a NextPageCommand flag then you can assume the Next button was clicked.


Actipro Software Support

Posted 18 years ago by Ray Huger
Avatar
Thank you for such a quick reply.

I am still not sure if your suggestion will work. The problem is that even if I update the state of the wizard (enable or disable pages that should or should not be in the desired path), the wizard has already decided which page to navigate to before the SelectedPageChanged event occurs. This leaves the wizard navigating to a disabled page in some instances. Is there way to resend the next command so that the wizard can skip the disabled page, or is there another event that would occur before the wizard makes that decision?

Thanks.
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ahh yes, I'm sorry there is a SelectedPageChanging event that fires before the change occurs and allows you to cancel it, etc.


Actipro Software Support

Posted 18 years ago by Ray Huger
Avatar
After cancling the command, can I then resend the next command so that it does infact go to the write page? I am not sure how to do this, if it is possible.

Thanks.
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I believe you can cancel it and yes, then call SelectedPage or select the new page via a command, etc.


Actipro Software Support

Posted 16 years ago by George Mills
Avatar
I'm having a similar issue. I want some pages to have their own validation before Next is accepted. The SelectedPageChanged works but it won't scale very elegantly because I have to keep editing it by hand with a case statement to find which page the user did next on. I'd like the page to be more encapsulated.

I suppose I can create my own base class for a Wizard page that includes a virtual Next handler that the SelectedPageChanged can unconditionally call through the sender parameter.

Seems this is such a basic function that it should be built in though.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi George,

Actually right now each WizardPage fires its own series of events when getting selected. So you can put code in there to have better encapsulation.

Check out the WizardPage.Selecting, Selected, Unselecting, and Unselected events.


Actipro Software Support

Posted 16 years ago by George Mills
Avatar
Doing the Base class on the page worked but I switched over to using Unselecting.

Thanks
The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.