Getting Started with the .NET MAUI Popup
This guide provides the information you need to start using the Telerik UI for .NET MAUI Popup by adding the control to your project.
At the end, you will be able to achieve the following result.
Prerequisites
Before adding the Popup, you need to:
Define the Control
-
When your .NET MAUI application is set up, you are ready to add a Popup control to your page.
For demonstration purposes, the current scenario demonstrates how to add a sample Popup attached to a Button control. The purpose of the Popup here is to receive user input—it contains the Entry control for allowing the user to enter a comment and a button for closing the popup.
<Button x:Name="button" HorizontalOptions="Center" VerticalOptions="Start" Text="Show more info" Clicked="ShowPopup"> <telerik:RadPopup.Popup> <telerik:RadPopup x:Name="popup" IsModal="True" OutsideBackgroundColor="#6F000000"> <telerik:RadBorder CornerRadius="8" BackgroundColor="Wheat"> <Grid Padding="10" WidthRequest="200" HeightRequest="150"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Label Text="Thank you for choosing Telerik UI for .NET MAUI." LineBreakMode="WordWrap" /> <telerik:RadButton Grid.Row="1" Padding="2" HorizontalOptions="End" Text="Close" Clicked="ClosePopup" AutomationId="CloseButton"/> </Grid> </telerik:RadBorder> </telerik:RadPopup> </telerik:RadPopup.Popup> </Button>
-
Reference the event handlers.
private void ClosePopup(object sender, EventArgs e) { popup.IsOpen = false; } private void ShowPopup(object sender, EventArgs e) { popup.IsOpen = true; }
-
Add the namespace.
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
-
Register the Telerik controls through the
Telerik.Maui.Controls.Compatibility.UseTelerik
extension method called inside theCreateMauiApp
method of theMauiProgram.cs
file of your project:using Telerik.Maui.Controls.Compatibility; public static class MauiProgram { public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseTelerik() .UseMauiApp<App>() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); }); return builder.Build(); } }
Additional Resources
- .NET MAUI Popup Product Page
- .NET MAUI Popup Forum Page
- Telerik .NET MAUI Blogs
- Telerik .NET MAUI Roadmap