title: Commands in WPF, Implementation question
body: <p>I know I've already asked questions on this, but something that's just confusing.
  I'm doing a tutorial on WPF MVVM pattern, but it seems I cannot get it right, as in the tutorial, it doesn't go into detail on how to implement the ICommand interface.  (not sure how correct it really is?!!)</p>
  
  <p>I have the following implementation of ICommand:</p>
  
  <pre><code>class ViewCommand : ICommand
      {
          #region ICommand Members
  
          private Predicate&lt;object&gt; _canExecute;
          private Predicate&lt;bool&gt; _execute(object param);
  
          public ViewCommand(Action&lt;object&gt; action)
          {
  
          }
  
          public bool CanExecute(object parameter)
          {
              return _canExecute == null ? true : _canExecute(parameter);
          }
  
          public void Execute(object parameter)
          {
              _execute(parameter);
          }
  
          public event EventHandler CanExecuteChanged 
          {
              add { CommandManager.RequerySuggested += value; }
              remove { CommandManager.RequerySuggested -= value; }
          }
  
          #endregion
      }
  </code></pre>
  
  <p>and now this use:</p>
  
  <pre><code>class StartViewModel : ViewModel
      {
          public ViewCommand startViewCommand;
  
          public ViewCommand StartCommand
          {
              get
              {
                  if (startViewCommand == null)
                      startViewCommand = new ViewCommand(
                          param =&gt; this.StartApplication()); // StartApplication returns void
                  return startViewCommand;
              }
          }
  </code></pre>
  
  <p>I cannot figure out what my constructor of the <code>ViewCommand</code> class is supposed to do?  In the  <code>StartViewModel</code> class it's using a lambda expression in the constructor, so there needs to be some delegate, but I'm not sure what and how it's meant to work with Execute and CanExecute. I put a <code>Action&lt;object&gt;</code>, but it's probably wrong...</p>
  
  <p>Lastly, can someone point me to a tutorial on how to implement ICommand that explains it?</p>
  
  <p>Thanks!</p>