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 “Next” or “Previous” button. WizardPageSelectionChangeEventArgs of SelectedPageChanging event have the following properties.
OldPage – Previous SelectedPage
NewPage – Current SelectedPage
Cause - Cause of the SelectionChanging. Value for Cause of SelectionChanging will be retrieved based on Button click.
The following code example explains how to restrict the new page selection while clicking “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; } } }