Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created December 5, 2017 19:54
Show Gist options
  • Save rdelrosario/b151a014ff904aded58b6e575ed63dfe to your computer and use it in GitHub Desktop.
Save rdelrosario/b151a014ff904aded58b6e575ed63dfe to your computer and use it in GitHub Desktop.
Android SetupPageTransition
protected override void SetupPageTransition(Android.Support.V4.App.FragmentTransaction transaction, bool isPush)
{
Page lastPage = null;
if (isPush)
{
if (Element?.Navigation?.NavigationStack?.Count() >= 2)
{
var previousPage = Element?.Navigation?.NavigationStack[Element.Navigation.NavigationStack.Count() - 2];
previousPage.PropertyChanged -= LastPage_PropertyChanged;
}
lastPage = Element?.Navigation?.NavigationStack?.Last();
SetupToolbarCustomization(lastPage);
lastPage.PropertyChanged += LastPage_PropertyChanged;
}
else if (Element?.Navigation?.NavigationStack?.Count() >= 2)
{
var previousPage = Element?.Navigation?.NavigationStack?.Last();
previousPage.PropertyChanged -= LastPage_PropertyChanged;
lastPage = Element?.Navigation?.NavigationStack[Element.Navigation.NavigationStack.Count() - 2];
lastPage.PropertyChanged += LastPage_PropertyChanged;
SetupToolbarCustomization(lastPage);
}
base.SetupPageTransition(transaction, isPush);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment