Reputation: 324
I have a WPF project based upon PRISM 6.1.0 Shell exposes TabControl as a "MainRegion". I need to display several views that loads data from the database. Data loading process takes time, and UI remains frozen. I've tried to RUN this procedd async like this
await Task.Run(() =>
{
RegionManager.RequestNavigate(RegionNames.MainRegion, "FirstView", parameters);
RegionManager.RequestNavigate(RegionNames.MainRegion, "SecondView", parameters);
....
RegionManager.RequestNavigate(RegionNames.MainRegion, "LastView", parameters);
});
but nothing happens, UI stays frozen untill last view will be loaded and only then displays all views in TabControl...
Is there any way to load Views asynchronously?
Upvotes: 0
Views: 1868
Reputation:
Navigate to your View first, and then have your View async load its data. You can show a busy indicator control to show something is being loaded in the background. When the data has been loaded, the busy indicator will hide and the View will display the newly loaded data.
Upvotes: 4