title: Call RelayCommand<T> with CanExecute Parameter
body: <p>How can I call a RelayCommand by passing in the CanExecute Parameter. The object is being bound as a command paramenter from the view. I have the following piece of code which says 'Delegate Func does not take 0 arguments'. Please help. The definition for OnPrintAllChartsInCurrentView and IsPrintAndExportEnabled is as follows.</p>
  
  <pre><code>     RelayCommand m_PrintAllChartsCommand;
                  public ICommand PrintAllChartsCommand
                  {
                      get
                      {
                          return m_PrintAllChartsCommand ?? (m_PrintAllChartsCommand = new RelayCommand&lt;object&gt;(
                              OnPrintAllChartsInCurrentView,
                              () =&gt; IsPrintAndExportEnabled() //This line there is a compiler error
                              ));
                      }
                  }
  
  private void OnPrintAllChartsInCurrentView(object obj)
          {
  //do something. The obj is bound as command parameter from the view.
          }
  
      private bool IsPrintAndExportEnabled()
      {
      //I will do some operation here and change to return true or false later
      return false;
      }
  </code></pre>
  
  <p>Here is the RelayCommand class that I am trying to call</p>
  
  <pre><code>namespace GalaSoft.MvvmLight.Command
  {
  
      public class RelayCommand&lt;T&gt; : ICommand
      {
          //
          // Summary:
          //     Initializes a new instance of the RelayCommand class that can always execute.
          //
          // Parameters:
          //   execute:
          //     The execution logic.
          //
          // Exceptions:
          //   T:System.ArgumentNullException:
          //     If the execute argument is null.
          public RelayCommand(Action&lt;T&gt; execute);
          //
          // Summary:
          //     Initializes a new instance of the RelayCommand class.
          //
          // Parameters:
          //   execute:
          //     The execution logic.
          //
          //   canExecute:
          //     The execution status logic.
          //
          // Exceptions:
          //   T:System.ArgumentNullException:
          //     If the execute argument is null.
          public RelayCommand(Action&lt;T&gt; execute, Func&lt;T, bool&gt; canExecute);
  
          //
          // Summary:
          //     Occurs when changes occur that affect whether the command should execute.
          public event EventHandler CanExecuteChanged;
  
          //
          // Summary:
          //     Defines the method that determines whether the command can execute in its current
          //     state.
          //
          // Parameters:
          //   parameter:
          //     Data used by the command. If the command does not require data to be passed,
          //     this object can be set to a null reference
          //
          // Returns:
          //     true if this command can be executed; otherwise, false.
          public bool CanExecute(object parameter);
          //
          // Summary:
          //     Defines the method to be called when the command is invoked.
          //
          // Parameters:
          //   parameter:
          //     Data used by the command. If the command does not require data to be passed,
          //     this object can be set to a null reference
          public virtual void Execute(object parameter);
          //
          // Summary:
          //     Raises the GalaSoft.MvvmLight.Command.RelayCommand`1.CanExecuteChanged event.
          public void RaiseCanExecuteChanged();
      }
  }
  </code></pre>