Category / Section
How to restrict selection of new page in Wizard control
1 min read
SelectedPageChanging event of WizardControl can be used to restrict the selection of new page while clicking the “Next” or “Previous” button. WizardPageSelectionChangeEventArgs of the SelectedPageChanging event have the following properties.
OldPage - Previously selected page.
NewPage - Current selected page.
Cancel - Used to cancel the selection of new page.
Cause - Cause of the selection changing. The value for cause of SelectionChanging will be retrieved based on the button click.
The following code example explains how to restrict the new page selection while clicking the “Next” button,
MainWindow.xaml:
<syncfusion:WizardControl Name="wizardControl" SelectedWizardPage="{Binding ElementName=wizpage2}"> <syncfusion:WizardPage Name="wizPage1" Title="Page 1" PageType="Exterior" Description="Content of Page 1" BackVisible="False" CancelVisible="True" FinishVisible="False" HelpVisible="True"> </syncfusion:WizardPage> <syncfusion:WizardPage Name="wizpage2" Title="Page 2" PageType="Exterior" Description="Content of Page 2" /> <syncfusion:WizardPage Name="wizPage3" Title="Page 3" PageType="Exterior" Description="Content of Page 3" CancelVisible="True" FinishVisible="True"/> </syncfusion:WizardControl>
MainWindow.cs:
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); wizardControl.SelectedPageChanging += WizardControl_SelectedPageChanging; } private void WizardControl_SelectedPageChanging(object sender, WizardPageSelectionChangeEventArgs e) { if(e.Cause == WizardPageSelectionChangeCause.NextPageCommand) { e.Cancel = true; } } }