title: wpf Wizard Toolkit validation after click next
body: <p>I'm using Wizard control from wpf extended toolkit, but right now I'm facing a problem. This is my view: </p>
  
  <pre><code>&lt;xctk:Wizard Width="300" Height="300" HelpButtonVisibility="Collapsed" FinishButtonVisibility="Visible" Name="wizard" Next="wizard_Next"&gt;
  &lt;i:Interaction.Triggers&gt;
      &lt;i:EventTrigger EventName="Next"&gt;
          &lt;mvvm:EventToCommand Command="{Binding NextCommand}" PassEventArgsToCommand="True"/&gt;
      &lt;/i:EventTrigger&gt;
  &lt;/i:Interaction.Triggers&gt;
  &lt;xctk:WizardPage x:Name="Step1Page" PageType="Blank" CanSelectNextPage="{Binding CanGoNext}" FinishButtonVisibility="Collapsed"&gt;
      &lt;Grid Margin="10"&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="Auto"/&gt;
  
          &lt;/Grid.RowDefinitions&gt;
          &lt;TextBlock Grid.Row="0" FontSize="14" Foreground="Red" Text="Log in to Vodafone One Net"/&gt;
          &lt;StackPanel Grid.Row="1" Margin="0,15,0,0"&gt;
              &lt;TextBlock  Text="Step 1" FontWeight="SemiBold"/&gt;
              &lt;TextBlock  Text="Please enter your mobile number"/&gt;
          &lt;/StackPanel&gt;
          &lt;xctk:WatermarkTextBox Grid.Row="2" Name="mobileNumber" PreviewKeyDown="OnPreviewKeyDown" AcceptsReturn="False" AcceptsTab="False" Watermark="Enter mobile number" Text="{Binding MobileNumber}"  Margin="0,10,0,0"&gt;
              &lt;i:Interaction.Triggers&gt;
                  &lt;i:EventTrigger EventName="TextChanged"&gt;
                      &lt;i:InvokeCommandAction Command="{Binding MobileNumberTextChangedCommand}" CommandParameter="{Binding ElementName=mobileNumber, Path=Text}"/&gt;
                  &lt;/i:EventTrigger&gt;
              &lt;/i:Interaction.Triggers&gt;
  
              &lt;i:Interaction.Behaviors&gt;
                  &lt;v:AllowableCharactersTextBoxBehavior RegularExpression="^\d+$" MaxLength="50" /&gt;
              &lt;/i:Interaction.Behaviors&gt;
          &lt;/xctk:WatermarkTextBox&gt;
  
      &lt;/Grid&gt;
  &lt;/xctk:WizardPage&gt;
  </code></pre>
  
  <p>....</p>
  
  <p>Then in my ViewModel with the CanGoNext I make a kind of validation so the user can go next or no (depending on if the textbox is filled with something or not).</p>
  
  <p>When the user clicks Next I make a REST call to validate the number, and if the number is not a valid one I don't want to go to step 2, but the wizard is always going to step2.</p>
  
  <p>I even tried to pass the CancelRoutedEventArgs in my RelayCommand doing this:</p>
  
  <pre><code>public async Task Next(CancelRoutedEventArgs e)
  {
      var resp = await this._requestService.PostRequestPin(this.MobileNumber);
  
      if (resp.StatusCode == ERROR)
      {
          e.Cancel = true;
          e.Handled = true;
      }
  
  }
  </code></pre>
  
  <p>The user always goes to step2. Anyone with any idea on how I can do ?</p>
  
  <p>Thanks.
  Regards,</p>