Skip to content

This provides extensibility for Prism.Forms INavigationService to handle Popup Views

License

Notifications You must be signed in to change notification settings

linnkrb/Prism.Plugin.Popups

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prism.Plugin.Popups

The Popups plugin provides an extremely lightweight framework for implementing Popup Pages using the Rg.Plugin.Popup package with Prism.Forms. To do this we simply provide you with some friendly extensions for the INavigationService so that you can navigate in a Prism friendly manner. Note that this does not currently support deep linking.

Current Build

Package Version
Prism.Plugin.Popups.Autofac 21
Prism.Plugin.Popups.DryIoc 22
Prism.Plugin.Popups.Ninject 23
Prism.Plugin.Popups.Unity 24

Usage

Version 2.X

Version 2.X deprecates the use of all but the ClearPopupStackAsync extension method. You can now register a PopupNavigationService which uses the base Prism PageNavigationService and adds support for Pushing and Popping PopupPage's. To use the PopupNavigationService see the registration example below for the DI container of your choice.

Autofac

protected override void RegisterTypes()
{
	var builder = new ContainerBuilder();
	builder.RegisterPopupNavigatioService();
	builder.UpdateContainer( Container );
}

All other containers

protectd override void RegisterTypes()
{
	Container.RegisterPopupNavigationService();
}

It's worth noting that there is a generic overload for the registration method that accepts any type that inherits from PopupPageNavigationServiceBase in the event that you have custom logic you need to execute in the NavigationService.

Version 1.X

There are three primary extensions added for working with Navigation.

  • ClearPopupStackAsync
  • PopupGoBackAsync (Obsolete in v2.X)
  • PushPopupPageAsync (Obsolete in v2.X)

All three of these contain overloads so that you can pass in a NavigationParameters object, or if you have a single key value pair you can pass it in as shown below for the NavigateCommand.

public class MyPageViewModel : BindableBase
{
	INavigationService _navigationService { get; }

	public MyPageViewModel( INavigationService navigationService )
	{
		_navigationService = navigationService;
		NavigateCommand = new DelegateCommand( OnNavigateCommandExecuted );
		GoBackCommand = new DelegateCommand( OnGoBackCommandExecuted );
	}

	public DelegateCommand NavigateCommand { get; }

	public DelegateCommand GoBackCommand { get; }

	private async void OnNavigateCommandExecuted()
	{
		await _navigationService.PushPopupPageAsync( "SomePopupPage", "message", "hello from MyPage" );
	}

	private async void OnGoBackCommandExecuted()
	{
		await _navigationService.PopupGoBackAsync();
	}
}

About

This provides extensibility for Prism.Forms INavigationService to handle Popup Views

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 96.8%
  • PowerShell 3.2%