I have a button, click it to start a task and disable the button, when the task is completed, I want to enable this button. Please give me any idea, concept or code to make it easy for me to understand.
my code is below:
In xaml:
<Button Name="myButton" Content="START" Click="ButtonStartClick" />
In xaml.cs:
private void ButtonStartClick(object sender, RoutedEventArgs e)
{
RunTask();
myButton.IsEnabled = false;
}
In viewModel.cs:
private void OnTaskCompleted(string result)
{
//how to enable myButton
}
See Question&Answers more detail:os