This project is read-only.

How to add events for the next button

Jul 24, 2012 at 11:14 PM

Hi there

I have been trying to add events to the next page button to do some stuff while moving to the next page or when I click the finish button, Any ideas?

Thanks in advance

Oct 18, 2012 at 9:49 PM

It took me a while to figure out, but I finally found out how by looking in the AvalonWizard Reference help documentation.

If you are using the MVVM library you can run code before going to the next page by setting a 'CommitCommand' in your ViewModel. Note that your ViewModel must be derived from WizardPageViewModelBase.

If you are not using MVVM I think you can use the 'OnCommit' method found in WizardPage. (I haven't tried this, but saw that it existed)

It would probably be more clear if if this was named 'NextCommand' and 'OnNext' instead of 'CommitCommand' and 'OnCommit'.

Oct 26, 2012 at 4:41 PM

You are right. When the user clicks Next button WizardPage.Commit event will be raised. And when the user clicks Back button WizardPage.Rollback event will be raised.

A small note here. If you use MVVM extensions you are not required to inherit WizardPageViewModelBase - this base class is made just for convenience. Your model should just implement IWizardPageViewModel interface. This interface is used for property autowiring.

But if you don't implement this interface in your view model, you can still bind view model properties using WizardMvvmBehavior.*Binding properties (e.g. CommitCommandBinding). You can also override autowired bindings this way.