Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Extended toolkit Wizard validation

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?

like image 649
David Avatar asked Oct 28 '14 00:10

David


2 Answers

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

like image 105
Programmer Avatar answered Oct 07 '22 14:10

Programmer


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.

like image 22
RWo Avatar answered Oct 07 '22 16:10

RWo