Skip to content

Instantly share code, notes, and snippets.

@codemillmatt
Created August 3, 2016 00:57
Show Gist options
  • Save codemillmatt/b9814f7e9a6cb79267edc48534b0c9fd to your computer and use it in GitHub Desktop.
Save codemillmatt/b9814f7e9a6cb79267edc48534b0c9fd to your computer and use it in GitHub Desktop.
Using view-model first navigation, pop the current view from the stack and then call an initialization function on the next view model that's about to be shown.
public async Task PopAsync<T>(Action<T> reInitialize = null) where T : BaseViewModel
{
await PopAsync();
var topPage = FormsNavigation.NavigationStack.Last() as IViewFor<T>;
if (topPage != null)
reInitialize?.Invoke(topPage.ViewModel);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment