title: Working with DelegateCommand's CanExecute action
body: <p>I've a ViewModel class like this in a Prism / WPF project.</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class ContentViewModel : ViewModelBase, IContentViewModel
  {
      public ContentViewModel(IPersonService personService)
      {
          Person = personService.GetPerson();
          SaveCommand = new DelegateCommand(Save, CanSave);
      }
  
      public Person Person { get; set; }
  
      public DelegateCommand SaveCommand { get; set; }
  
      private void Save()
      {
          // Save actions here...
      }
  
      private bool CanSave()
      {
          return Person.Error == null;
      }
  }
  </code></pre>
  
  <p>The person type used in the above ViewModel is defined as follows:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Person : INotifyPropertyChanged, IDataErrorInfo
  {
      private string _firstName;
      public string FirstName
      {
          get { return _firstName; }
          set
          {
              _firstName = value;
              OnPropertyChanged("FirstName");
          }
      }
  
      // other properties are implemented in the same way as above...
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      protected void OnPropertyChanged(string propertyName)
      {
          if (PropertyChanged != null)
              PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
  
      private string _error;
      public string Error
      {
          get
          {
              return _error;
          }
      }
  
      public string this[string columnName]
      {
          get
          {
              _error = null;
              switch (columnName)
              {
                  // logic here to validate columns...
              }
              return _error;
          }
      }
  }
  </code></pre>
  
  <p>An instance of ContentViewModel is set as DataContext of a View. Inside the View I've used binding to Person as follows:</p>
  
  <pre><code>&lt;TextBox Text="{Binding Person.FirstName, ValidatesOnDataErrors=True}" /&gt;
  &lt;Button Content="Save" Command="{Binding SaveCommand}" /&gt;
  </code></pre>
  
  <p>When I make changes to TextBox which is binded to Person's properties like FirstName and click Save I could see the changes in ViewModel command handler. But if any of these properties fail in validation CanSave is never executed and button never gets disabled. </p>
  
  <p>How do I disable a button based on DelegateCommand's CanExecute action handler in the above scenario?</p>