I have a problem with my UI not updating while executing a Command.
I've got an indeterminate ProgressBar which has it's visibility bound to the IsBusyIndicator-property in the ViewModel. A Command should now excecute a method and show the ProgressBar while computing, as shown in the codesnippett below. However, this doesn't work as I'd expect. The property is set to the correct value but the UI doesn't update to show the ProgressBar.
It works fine if I just set the IsBusyIndicator to true and do nothing else in the Command, so INotifyPropertyChanged and the Binding are working correctly.
void CommandExecute()
{
IsBusyIndicator = true;
// Do stuff that takes long
IsBusyIndicator = false;
}
It seems to me that the UI waits for the Command to finish before it updates the View. Is there a way to force the UI to update right away?
Thanks in advance, may the force be with you.
CommandExecute()method is running on UI thread you can not do that.// Do stuff that takes longshould be run on another thread.