XCT.Popups.Prism 0.1.2

Install-Package XCT.Popups.Prism -Version 0.1.2
dotnet add package XCT.Popups.Prism --version 0.1.2
<PackageReference Include="XCT.Popups.Prism" Version="0.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XCT.Popups.Prism --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XCT.Popups.Prism, 0.1.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install XCT.Popups.Prism as a Cake Addin
#addin nuget:?package=XCT.Popups.Prism&version=0.1.2

// Install XCT.Popups.Prism as a Cake Tool
#tool nuget:?package=XCT.Popups.Prism&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Unofficial package that allows the use of Xamarin.Community.Toolkit popups within a Prism based Xamarin.Forms project.

NOTE This package will likely be superseded by the official Prism package, unfortunately there is currently no time frame on when that will become available - hence why I have created this.


The library can be installed from NuGet:

  • This can be done through your IDE with the NuGet package manager
    • Note: You will only need to install the package in your Xamarin.Forms project.
  • Ensure that you install the Xamarin.Community.Toolkit package in all the required platform projects.

Getting Started

Once the package is installed you're good to go, so lets get started!

Create a Popup

A popup must inherit from PrismPopup, which itself inherits from the Xamarin.CommunityToolkit.UI.Views.Popup, in order to work properly.

<?xml version="1.0" encoding="utf-8" ?>
    Size="300, 300">
            Text="Welcome to XCT.Popups.Prism.Sample!"
            HorizontalOptions="CenterAndExpand" />
            Command="{Binding DismissCommand}"/>


Create a ViewModel

Your ViewModel class must implement the IPopupAware interface otherwise it will not work with the PopupService.


Implementing IPopupAware on your ViewModel provides you with access to all the methods that you will need thoughout the lifetime of the popup.

public class HelloWorldPopupViewModel : ViewModelBase, IPopupAware
    public DelegateCommand DismissCommand { get; }

    // Hooked into by the PopupService to trigger the dismiss of the Xamarin.Community.Toolky popup.
    // Invoke this when you want to dismiss the popup from code: see DimsissCommandExecuted below.
    public event Action<IPopupParameters> RequestDismiss;

    public HelloWorldPopupViewModel(INavigationService navigationService)
        : base(navigationService)
        DismissCommand = new DelegateCommand(DimsissCommandExecuted);

    // Invoked when the popup is opened
    public void OnPopupOpened(IPopupParameters parameters)

    // Invoked when the popup is dismissed via RequestDismiss
    public void OnPopupDismissed()

    private void DimsissCommandExecuted()
        RequestDismiss?.Invoke(new PopupParameters()
            { "dismissedParam", "This was returned from the popup viewmodel" }


This is an optional interface that provides you with a way of passing parameters back when a popup was light dismissed. Simply implement the interface on your ViewModel and return the desired parameters inside OnPopupLightDismissed:

public IPopupParameters OnPopupLightDismissed()
    return new PopupParameters()
        { "lightDismissedParam", "This was returned from the popup viewmodel when it was light dismissed" }

Register the Popup

Regsitering a popup is done in pretty much the same way that pages and ViewModels are registered but using the popup specific extension method RegisterPopup:

protected override void RegisterTypes(IContainerRegistry containerRegistry)
    containerRegistry.RegisterPopup<HelloWorldPopup, HelloWorldPopupViewModel>();

Using the Popup Service

Register the PopupService implementation with the container within RegisterTypes so that it can be injected as a dependency:

protected override void RegisterTypes(IContainerRegistry containerRegistry)
    containerRegistry.RegisterSingleton<IPopupService, PopupService>();

The simplest way to show a popup is to call ShowPopup:

var parameters = new PopupParameters()
    { "message", "Hello world!" }

_popupService.ShowPopup("HelloWorldPopup", parameters, (result) => { }); // Callback can be null

Popups can be shown asynchronously by using the ShowPopupAsync extension method:

IPopupResult result = await _popupService.ShowPopupAsync("HelloWorldPopup", new PopupParameters()
    { "message", "Hello world!" }

result.Exception // Any exception thrown when trying to show/dismiss a popup
result.LightDismissed // Whether the popup was dismissed by tapping outside the popup or not
result.Parameters // The parameters returned from the popup

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.2 228 5/31/2021
0.1.0 186 5/25/2021