Problem is that you're running your EF call in Main thread. This blocks UI from being updated until you'll receive all data from the DB.
To fix this just add BackgroundWorker
or async methods:
var worker = new BackgroundWorker();
worker.DoWork += (s, e) => {
this.IsLoading = true;
this.Persons = _context.persons;
};
worker.RunWorkerCompleted += (s, e) => {
this.IsLoading = false;
};
Important: Keep in mind cross-thread access (DoWork performed in background thread, Completed - UI thread )
And at the end to start/trigger DoWork you will need to execute .RunWorkerAsync()
on your worker.