public RelayCommand MyCommand { get; set; } MyCommand = new RelayCommand(() => { Console.WriteLine("Hello World"); });
public RelayCommandThis code example creates a RelayCommand named MyCommand that is bound to the action of writing the passed parameter value to the console. These examples demonstrate the use of RelayCommand to define commands in the C# language with actions or functions as parameters. To use RelayCommand, you need to install the MVVM Light package library.MyCommand { get; set; } MyCommand = new RelayCommand ((parameter) => { Console.WriteLine(parameter); });