# Events

This article lists the events specific to RadWizard control.

## Selection events:

* **SelectionChanging**: Occurs when the selected page is about to be changed. The type of the passed event arguments is **SelectedPageChangingEventArgs**. Through this class, you can access the following properties:

  * **Cancel**: A boolean property that enables the cancellation of the selection.
  * **Direction**: A property, which gets the direction in which the user is navigating to. There are two possible values specifying in which direction a user is navigating between pages ***“Forward”*** and ***“Backward”***.
  * **OldPage**: A **WizardPage** property, which gets the currently selected wizard page.
  * **NewPage**: A **WizardPage** property, which gets the wizard page to be selected.

**Example 1: Subscribe to the SelectionChanging Event**

```C#
private void wizard_SelectionChanging(object sender, SelectedPageChangingEventArgs e)
{
    var cancel = e.Cancel;
    var selectionDirection = e.Direction;
    var newPage = e.NewPage;
    var oldPage = e.OldPage;
}
```

* **SelectionChanged**: Occurs when the selected page has changed. The type of the passed event arguments is **SelectedPageChangedEventArgs**. Through this class, you can access the following properties:

  * **Direction**: An enumeration property, which gets the direction in which the user is navigating. There are two possible values specifying in which direction the user is navigating between pages ***“Forward”*** and ***“Backward”***.
  * **OldPage**: A **WizardPage** property, which gets the currently selected wizard page.
  * **NewPage**: A **WizardPage** property, which gets the wizard page to be selected.

**Example 2: Subscribe to the SelectionChanged Event**

```C#
private void wizard_SelectionChanged(object sender, SelectedPageChangedEventArgs e)
{
    var selectionDirection = e.Direction;
    var newPage = e.NewPage;
    var oldPage = e.OldPage;
}
```

## Navigation buttons events

All of the event handlers for these events receive two arguments and are executed per wizard page. The sender argument contains the **RadWizard**. This argument is of type object, but can be cast to the **RadWizard** type. A **NavigationButtonsEventArgs** object. This object has the **SelectedPageIndex** property, which is used to get or set the selected page index.

* **Previous**: Occurs when the **Previous** button has been clicked.
* **Next**: Occurs when the **Next** button has been clicked.
* **Finish**: Occurs when the **Finish** button has been clicked.
* **Help**: Occurs when the **Help** button has been clicked.
* **Cancel**: Occurs when the **Cancel** button has been clicked.

**Example 3: Navigation buttons event handlers**

```C#
private void wizard_Previous(object sender, NavigationButtonsEventArgs e)
{
    var selectedPageIndex = e.SelectedPageIndex;
}

private void wizard_Next(object sender, NavigationButtonsEventArgs e)
{
    var selectedPageIndex = e.SelectedPageIndex;
}

private void wizard_Finish(object sender, NavigationButtonsEventArgs e)
{
    var selectedPageIndex = e.SelectedPageIndex;
}

private void wizard_Help(object sender, NavigationButtonsEventArgs e)
{
    var selectedPageIndex = e.SelectedPageIndex;
}

private void wizard_Cancel(object sender, NavigationButtonsEventArgs e)
{
    var selectedPageIndex = e.SelectedPageIndex;
}
```

## Other events:

* **PageLoaded**: Occurs when a new page is loaded. The **PageEventArgs** class exposes the **Page** property, which gets the currently loaded page in the wizard.

* **Completing**: Occurs when the operation is about to be completed. The **WizardCompletingEventArgs** class exposes the following specific properties:

  * **Cancel**: A boolean property that enables the cancellation of the finish operation.
  * **SelectedPage**: A **WizardPage** property, which gets the page from which it was invoked.
  * **Action**: A property, which gets the action which will be performed. There are two possible actions ***“Abort”*** and ***“Finish”***. The **Action** property will be with value ***“Abort”*** when the user has clicked the **Cancel** button and ***“Finish”*** when the **Finish** button is clicked.

**Example 4: Subscribe to the Completing Event**

```C#
private void wizard_Completing(object sender, WizardCompletingEventArgs e)
{
    var cancel = e.Cancel;
    var action = e.Action;
    var selectedPage = e.SelectedPage;
}
```

* **Completed**: Occurs when the wizard has already finish. The	 **WizardCompletedEventArgs** class exposes the following specific properties:

  * **SelectedPage** - a **WizardPage** property, which gets the page from which it was invoked.
  * **Action** -an enumeration property, which gets the action which was performed. There are two possible actions ***“Abort”*** and ***“Finish”***. The **Action** property will be with value ***“Abort”*** when the user had clicked the **Cancel** button and ***“Finish”*** when the **Finish** button was clicked.

**Example 5: Subscribe to the Completed Event**

```C#
private void wizard_Completed(object sender, WizardCompletedEventArgs e)
{
    var action = e.Action;
    var selectedPage = e.SelectedPage;
}
```

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radwizard/getting-started)
