Using Plugin.Maui.Popup to Create Eye-Catching Popups in Apps

Leave a Comment

Plugin.Maui.Popup is a flexible and user-friendly tool for producing and showing popups in your Xamarin.Forms application. With its adjustable choices and excellent animations, you may improve your app's user experience by adding popups to crucial messages or prompts.




Installing the plugin MAUI popup package

First, install the Plugin.Maui.Popup package for your project. You can accomplish this by entering the following command into your NuGet Package Manager Console.

Install-Package Plugin.Maui.Popup

Or by managing the NuGet Project.

Creating a custom popup page

Now make your own custom popup page.

<?xml version="1.0" encoding="utf-8" ?>
<mauiPopup:BasePopupPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:mauiPopup="clr-namespace:MauiPopup.Views;assembly=MauiPopup"
             x:Class="CustomPickerControl.CustomControls.PickerControlView"
             Margin="10,0,10,0"
             VerticalOptions="Center"
             Title="PickerControlView">
    <Grid Padding="15,5,15,0" x:Name="grv">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Label Grid.Row="0" Text="Select Item" FontSize="22" FontAttributes="Bold" />
        <CollectionView Grid.Row="1"
                         x:Name="clPickerView"
                         VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
                         SelectionMode="Single"
                         SelectionChanged="clPickerView_SelectionChanged">
        </CollectionView>
    </Grid>
</mauiPopup:BasePopupPage>
Calling the popup from the code behind

Call the popup from the code behind here I'm using the main page

private async void dropdownControl_OpenPickerEvent(object sender, EventArgs e)
{
    dropdownControl.IsLoading = true;
    // response return from api
    var items = new List<TitleValue>();
    items.Add(new TitleValue { Title = "Title 1" });
    items.Add(new TitleValue { Title = "Title 2" });
    items.Add(new TitleValue { Title = "Title 3" });
    items.Add(new TitleValue { Title = "Title 4" });
    items.Add(new TitleValue { Title = "Title 5" });
    items.Add(new TitleValue { Title = "Title 6" });
    items.Add(new TitleValue { Title = "Title 7" });
    dropdownControl.ItemSource = items;
    await Task.Delay(1000);
    dropdownControl.IsLoading = false;
    dropdownControl.IsDisplayPickerControl = true;
}

Output

Windows Hosting Recommendation

HostForLIFEASP.NET receives Spotlight standing advantage award for providing recommended, cheap and fast ecommerce Hosting including the latest Magento. From the leading technology company, Microsoft. All the servers are equipped with the newest Windows Server 2022 R2, SQL Server 2022, ASP.NET Core 7.0.10 , ASP.NET MVC, Silverlight 5, WebMatrix and Visual Studio Lightswitch. Security and performance are at the core of their Magento hosting operations to confirm every website and/or application hosted on their servers is highly secured and performs at optimum level. mutually of the European ASP.NET hosting suppliers, HostForLIFE guarantees 99.9% uptime and fast loading speed. From €3.49/month , HostForLIFE provides you with unlimited disk space, unlimited domains, unlimited bandwidth,etc, for your website hosting needs.
 
https://hostforlifeasp.net/

 

Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a Comment