How to define an interface for methods marked with [RelayCommand]
08:45 16 Jun 2024

My team requires interfaces for our ViewModels. I love the MVVM Community Toolkit but I want to use both interfaces and [RelayCommand] Attributed class methods.

How do I define an interface for DownloadConfigurationCommand in the following scenario using my ObservableObject descendant class?

The following generates a 'Command' that is public called:

DownloadConfigurationCommand

The code is defined as:

 [RelayCommand]
private async Task DownloadConfiguration(AppConfiguration appConfiguration)
{
    // TODO: Call DownloadConfiguration Configuration
    await Task.Delay(10);
}

FYI: The code works but misses the Team requirement of having an interface defined.

Thanks in advance!

c# mvvm community-toolkit-mvvm