I have simple 2 buttons. Should I create 1 ICommand or is it ok now?
internal class MainPageViewModel : INotifyPropertyChanged
{
public ICommand RegisterBtnClickedCommand {get; }
public ICommand LoginBtnClickedCommand {get; }
public MainPageViewModel()
{
RegisterBtnClickedCommand = new Command(RegisterButtonPressed);
LoginBtnClickedCommand = new Command(LoginButtonPressed);
}
private void LoginButtonPressed()
{
Application.Current.MainPage.DisplayAlert("Login", "Login", "ok");
}
private void RegisterButtonPressed()
{
Application.Current.MainPage.DisplayAlert("Reg", "Reg", "ok");
}
public event PropertyChangedEventHandler PropertyChanged;
}
And for example, if I had 10 buttons, then I should have 10 commands?