How can I call an async command with a view model?

And to expand on already provided answer, if you need to pass a parameter to the command, you can use something like

(resetButtonClickedCommand = new Command<object>(async (o) => await SomeMethod(o)));

async Task SomeMethod(object o)
{
    // do stuff with received object
}

You could replace object above by anything you want as well.


You can try something like this:

(resetButtonClickedCommand = new Command(async () => await SomeMethod()));

async Task SomeMethod()
{
    // do stuff
}