I am using MVVM to display a busy indicator. If I tell the indicator to show in an async on click event in code behind it shows up. However when I have my view model set the exact same property to true from a command it never shows up.
<
telerik:RadBusyIndicator
Name
=
"LoggingInBusyIndicator"
BusyContent
=
"Logging In"
IsBusy
=
"{Binding ShowLoginIndicator}"
DisplayAfter
=
"0"
>
<!--Button code inside of grid-->
</
telerik:RadBusyIndicator
>
private async void InstructorLoginButton_Click(object sender, RoutedEventArgs e)
{
MainMenuViewModel pageViewModel = (this.DataContext as MainMenuViewModel);
pageViewModel.ShowLoginIndicator = true;
try
{
//Do login stuff
}
catch (UserLoginException ule)
{
pageViewModel.SetInstructorLoginError(ule.Message);
}
pageViewModel.ShowLoginIndicator = false;
}
View Model Code the indicator never shows but if I remove the async call it shows up.
private RelayCommand studentLoginCommand;
public RelayCommand StudentLonginCommand
{
get
{
return studentLoginCommand = studentLoginCommand ?? new RelayCommand(async() =>
{
ShowLoginIndicator = true;
bool isStudentloggedIn = await LoginStudent();
if (isStudentloggedIn)
{
//Handle login
ShoLoginIndicator=false;
}
else
{
ShowLoginIndicator = false;
}
});
}
}