December 2019
Intermediate to advanced
528 pages
11h 19m
English
In the UI, we had a button that had its Command property set. In this section, we won't have a look at what the Command actually looks like. In this code, we'll be using a wrapper class called RelayCommand. We'll come back to RelayCommand shortly, but a command is simply any class that implements the ICommand interface. The helper class that we're using here just means that we can declare the command functionality inside the ViewModel.
Initially, we just declare the RelayCommand:
public RelayCommandAsync<string> SendMessageCommand { get; set; }
Then, we instantiate this inside the constructor:
public MainViewModel() { SendMessageCommand = new RelayCommandAsync<string>(SendMessage);}
As you can see, we're passing a method to ...
Read now
Unlock full access