Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save syaifulnizamyahya/30788aca67a3dc1c74a7925e48801c44 to your computer and use it in GitHub Desktop.

Select an option

Save syaifulnizamyahya/30788aca67a3dc1c74a7925e48801c44 to your computer and use it in GitHub Desktop.
WPF MVVM Toolkit add new button with async command
in xaml
<Button Content="Generate key" Command="{Binding GenerateKeyCommand}"/>
in viewmodel
private IAsyncRelayCommand generateKeyCommand;
public IAsyncRelayCommand GenerateKeyCommand => generateKeyCommand ??= new AsyncRelayCommand(GenerateKey);
private Task GenerateKey()
{
MessageBox.Show("GenerateKey");
return Task.CompletedTask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment