Hi, I have this MVVM app and I need to show a BusyIndicator when it does this heavy load method.
It works fine the first time, when I try to run it again, looks like it's not starting the BusyIndicator. And it just does nothing.
Here's the code I'm using to show the BusyIndicador
The BusyIndicator it's binding to this property
And here's how I change the state of the binded property
I also tried setting the IsBusy property outside of the DoWork method, but got the same results.
Any idea what it might be the issue?
It works fine the first time, when I try to run it again, looks like it's not starting the BusyIndicator. And it just does nothing.
Here's the code I'm using to show the BusyIndicador
The BusyIndicator it's binding to this property
private
bool
_isBusy;
public
bool
IsBusy
{
get
{
return
_isBusy; }
set
{
if
(_isBusy == value)
return
;
_isBusy = value;
OnPropertyChanged();
}
}
And here's how I change the state of the binded property
var backgroundWorker =
new
BackgroundWorker();
backgroundWorker.DoWork +=
delegate
{
IsBusy =
true
;
DoHeavyWork();
};
backgroundWorker.RunWorkerCompleted +=
delegate
{
IsBusy =
false
;
};
backgroundWorker.RunWorkerAsync();
I also tried setting the IsBusy property outside of the DoWork method, but got the same results.
Any idea what it might be the issue?