I\'m looking at the full implementation of a Relay Command that can be found here
I heard that the idea behind RelayCommand is to have a sort of \"universal remote contr
1) ICommand only has methods that include a parameter. If you don't specify a parameter in XAML, null is used.
https://msdn.microsoft.com/en-us/library/system.windows.input.icommand(v=vs.110).aspx
2) Yes, you can effect CanExecute without a CommandParameter. See below, it uses the viewmodel's string property "MyData" in CanExecute.
MainWindow.xaml
MainWindow.xaml.cs
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
namespace WpfApplication8
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
public class MainWindowViewModel : INotifyPropertyChanged
{
private ICommand command1;
public ICommand Command1 { get { return command1; } set { command1 = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Command1))); } }
private string myData;
public string MyData { get { return myData; } set { myData = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MyData))); } }
public event PropertyChangedEventHandler PropertyChanged;
public MainWindowViewModel()
{
Command1 = new RelayCommand