https://github.com/redth/plugin.maui.poppedcontentview
Simple popup control & service for .NET MAUI
https://github.com/redth/plugin.maui.poppedcontentview
Last synced: about 1 year ago
JSON representation
Simple popup control & service for .NET MAUI
- Host: GitHub
- URL: https://github.com/redth/plugin.maui.poppedcontentview
- Owner: Redth
- License: mit
- Created: 2023-08-28T21:53:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-30T15:18:17.000Z (almost 3 years ago)
- Last Synced: 2025-04-10T00:17:50.853Z (about 1 year ago)
- Language: C#
- Size: 8.33 MB
- Stars: 14
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Plugin.Maui.PoppedContentView
`Plugin.Maui.PoppedContentView` is a simple control / service for presenting popup content in .NET MAUI apps.

## Install Plugin
[](https://www.nuget.org/packages/Plugin.Maui.PoppedContentView/)
Available on [NuGet](http://www.nuget.org/packages/Plugin.Maui.PoppedContentView).
Install with the dotnet CLI: `dotnet add package Plugin.Maui.PoppedContentView`, or through the NuGet Package Manager in Visual Studio.
## Setup
In your _MauiProgram.cs_ file, call the `builder.UsePopped()` method on your builder to configure the plugin.
In your app you can inject the `IPoppedNavigationService` as normally, or get it from the service provider manually, eg:
```csharp
this.Handler.MauiContext.Services.GetService();
```
## Usage
Once you have an instance of the service, you can show popups:
```csharp
await poppedNavService.ShowAsync(this.Window, new SimplePoppedView());
```
The first argument is an `IWindow` which should be the window you would like to present the popup within. The second argument is an `IPoppedContentView`. The easiest way to create this is to make a new control which subclasses the `PoppedContentView` implementation, eg:
```xaml
```
The `PoppedContentView` is just a subclass of `ContentView` which implements a couple more methods such as `PoppingInAsync()` and `PoppingOutAsync()`.
## Closing
There's no built in mechanism for closing when the background of the popup is tapped. You can wire this up yourself with a Tap gesture recognizer on your view(s) and then calling the `HideAsync(IPoppedContentView)` method.
## Animations
Currently there is no built-in animations. You can however accomplish them using the MAUI animation API's from within the `PoppingInAsync()` and `PoppingOutAsync()` methods (the sample shows how to do this).