Last active
July 22, 2024 07:46
-
-
Save syaifulnizamyahya/30788aca67a3dc1c74a7925e48801c44 to your computer and use it in GitHub Desktop.
WPF MVVM Toolkit add new button with async command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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