0

I need to create validation: if all fields are filled

IsEnabled=true; //in xaml for next tabItem

If not all fields are filled

IsEnabled=false; //in xaml for next tabItem

I want that validation be always while user see TabItems (Control\Window). I want something like Button's Command that has

public WizardCommand(Action execute, Func<bool> canExecute)
{
   if (execute == null)
      throw new ArgumentNullException("execute");

   this.execute = execute;

   if (canExecute != null)
      this.canExecute = canExecute;
}

Button's Command call WizardCommand(Action execute, Func canExecute) automatically while button is on form. How make tabitem work like button with command on mvvm with binding?

Somedust
  • 1,150
  • 1
  • 19
  • 28
Risa
  • 147
  • 1
  • 2
  • 15
  • What's the problem? Create `IsEnabled` property in your view model, bind it to `TabItem.IsEnabled`. Then change that property every time, when validation occurs. – Dennis Dec 04 '13 at 06:25
  • when validation occurs - this is the problem. How to generate this "when validation occurs" – Risa Dec 04 '13 at 06:26
  • Call validation method when fields change – Ramashankar Dec 04 '13 at 06:33
  • no, i have 50 fields, and i need something like command only – Risa Dec 04 '13 at 06:36
  • WPF supports three validation approaches: validation using valudation rules, validation using exceptions, validation using `IDataErrorInfo`. There are many articles/blog entries, which describes these approaches. This question also will be helpful: http://stackoverflow.com/questions/63646/wpf-data-binding-and-validation-rules-best-practices – Dennis Dec 04 '13 at 06:36
  • ... i can't understand, why you do not want to hear me... – Risa Dec 04 '13 at 06:53

0 Answers0