Once clicked, a button turns from blue to grey and will not return to the original blue color.
I create a new .NET MAUI app and install CommunityToolkit.MVVM (V8.0.0). Then create a MainPageViewModel and hook it up to the MainPage View.
In the MainPageViewModel I have two [RelayCommand] methods. One is async and the other is not.
I add two buttons to the MainPage XAML and use the Command attribute to assign each of the 'RelayCommand' handlers to the buttons. The methods just dump to System.Diagnostics.Debug.
When I execute the app on Windows 10 and click the non-async button, I see the diagnostic dump and the button background color remains blue. i.e. the original color. i.e. this is the behavior I expect for both buttons.
When I click on the async button, I see the diagnostic dump but the button background color changes from blue to grey. The button is still enabled. If I click again, I see the diagnostic dump again.
How do I get the 'async' button back into the original state.
Snippet from the MainPageViewModel:
public partial class MainPageViewModel : ObservableObject
{
[RelayCommand]
async Task TestSomethingAsync()
{
await Task.Delay(1);
System.Diagnostics.Debug.WriteLine(nameof(TestSomethingAsync));
}
[RelayCommand]
void TestMore()
{
System.Diagnostics.Debug.WriteLine(nameof(TestMore));
}
}
Snippet from the MainPage.xaml:
<Button
Text="T1 Async"
Command="{Binding TestSomethingCommand}"
HorizontalOptions="Center" />
<Button
Text="T2"
Command="{Binding TestMoreCommand}"
HorizontalOptions="Center" />