Those extensions for Xamarin.Forms basicaly add storage of the navigation history when the application stops. Extensions has been prefered to subclassing for more flexibility.
The library is available on NuGet.
To install NavigationExtensions, run the following command in the Package Manager Console.
PM> Install-Package Xam.Forms.NavigationExtensions
Once you installed the package, extension methods will be automaticaly added to INavigation
and Page
.
To add storage and restoration of navigation stack :
public class App : Application
{
public App()
{
MainPage = new NavigationPage(new HomePage());
}
protected override async void OnStart()
{
// If the app is launched one hour after its last stop, its navigation history
// will be restored.
await this.MainPage.Navigation.RestoreAsync("Main", TimeSpan.FromHours(1));
}
protected override void OnSleep()
{
this.MainPage.Navigation.Store("Main");
}
}
To navigate from a page to another by passing arguments :
this.Navigation.PushAsync<AlbumPage>(item.Identifier, true);
And finaly access navigation argument from your destination page :
var albumId = (int) this.GetNavigationArgs();
A complete application sample is available in the source code solution.
Publishing is done through Visual Studio Team Services with a manual trigger.
- Add more helpers for selected tab item, scrolling amount, textfield
Code and documentation copyright 2016 Aloïs Deniel released under the MIT license.