Load target view's data before transitioning
This commit is contained in:
parent
545b5b1f43
commit
16495770ba
1 changed files with 5 additions and 3 deletions
|
|
@ -49,17 +49,17 @@ public partial class NavigationService : ObservableObject, INavigationService
|
|||
}
|
||||
|
||||
// Show the loading overlay and yield so the UI thread can paint it
|
||||
// BEFORE the heavy view creation from the ContentControl DataTemplate.
|
||||
// over the CURRENT view before we do any heavy work.
|
||||
IsNavigating = true;
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Render).GetTask();
|
||||
|
||||
CurrentView = viewModel;
|
||||
|
||||
try
|
||||
{
|
||||
if (initializeAsync != null)
|
||||
await initializeAsync();
|
||||
|
||||
CurrentView = viewModel;
|
||||
|
||||
// Yield again so the new view finishes layout/render
|
||||
// before we hide the overlay.
|
||||
await Dispatcher.UIThread.InvokeAsync(() => { }, DispatcherPriority.Background).GetTask();
|
||||
|
|
@ -67,6 +67,8 @@ public partial class NavigationService : ObservableObject, INavigationService
|
|||
catch
|
||||
{
|
||||
// Initialization errors are handled by the caller's callback.
|
||||
// Still swap to the target view so navigation isn't left stuck.
|
||||
CurrentView = viewModel;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue