New to Telerik UI for .NET MAUI? Start a free 30-day trial

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 achieve the following result.

.NET MAUI Popup Getting Started

Prerequisites

Before adding the Popup, you need to:

  1. Set up your .NET MAUI application.

  2. Download Telerik UI for .NET MAUI.

  3. Install Telerik UI for .NET MAUI.

Define the Control

1. 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 shows 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>

2. Reference the event handlers.

private void ClosePopup(object sender, EventArgs e)
{
    popup.IsOpen = false;
}
private void ShowPopup(object sender, EventArgs e)
{
    popup.IsOpen = true;
}

3. Add the namespace.

xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"

4. Register the Telerik controls through the Telerik.Maui.Controls.Compatibility.UseTelerik extension method called inside the CreateMauiApp method of the MauiProgram.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

See Also

In this article