Using a wizard in my application that validates the input. The user must not be able to move to the next page if the validation is not a success. This can be done by disabling the next button when validation failes. The NextButtonEnabled property is hooked to the Validation.HasError property of the inputcontrol. Code sample below.
<wizard:WizardPage x:Name="WizardPage"> <!--Style that sets the NextButtonEnabled based on validation--> <wizard:WizardPage.Style> <Style TargetType="wizard:WizardPage"> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=DataControl,Path=(Validation.HasError), UpdateSourceTrigger=PropertyChanged}" Value="True"> <Setter Property="NextButtonEnabled" Value="False" /> </DataTrigger> </Style.Triggers> </Style> </wizard:WizardPage.Style> <!--Input controls--> <AdornerDecorator> <TextBox Name="DataControl"> <TextBox.Text> <Binding Path="MyValue" UpdateSourceTrigger="PropertyChanged" > <Binding.ValidationRules> <my:NotNullOrEmptyValidationRule ErrorMessage="Supply data"/> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox> </AdornerDecorator> </wizard:WizardPage>
This doesn’t cover the user directly clicking the next button, but that is handled by the check in the Unselecting eventhandler.