I'm using the WPF Extended toolkit Wizard.
I'm wondering how I can go about validating that all controls have been filled out on a page before allowing the user to navigate forward.
I know I can trap the Next button click in my code behind:
private void Wizard_Next(object sender, Xceed.Wpf.Toolkit.Core.CancelRoutedEventArgs e)
{
}
I know I can detect which page on the Wizard I am on based on the sender, but how do I get a handle on the Controls that are on that wizard page?
You can do it by CanSelectNextPage through xaml For example:
<xctk:WizardPage.CanSelectNextPage>
<MultiBinding Converter="{StaticResource NextFromPage1}">
<Binding ElementName ="checkbox1" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName ="checkbox2" Path="IsChecked" Mode="OneWay"/>
<Binding ElementName ="text1" Path="Text" Mode="OneWay"/>
<Binding ElementName ="text2" Path="Text" Mode="OneWay"/>
</MultiBinding>
</xctk:WizardPage.CanSelectNextPage>
Any you can insert your code to converter which will validate your controls
It is as simple as..
e.Cancel = true;
This tells the 'Wizard' to cancel the on next request and it will stay on the current page.
What you can also do is to jump to any other page like this.
e.Cancel = true;
Wizard.CurrentPage = PageNo
Useful if you want to combine a variety of options based on user selections. In other words you can bypass the linear process and jump between pages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With