Search This Blog

Saturday 24 September 2022

Monday 19 September 2022

Plugin.Maui.Popup

How to use Plugin.Maui.Popup 

Install Plugin.Maui.Popup Plugin in your project.

https://www.nuget.org/packages/Plugin.Maui.Popup   (1.0.4)








Now add xmlns:mauiPopup="clr-namespace:MauiPopup.Views;assembly=MauiPopup" this namespace in your content page.

Also replace ContentPage tag to <mauiPopup:BasePopupPage.

PopupPage.xaml
<?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="MauiPopupDemo.PopupPage"
             Title="PopupPage">
    <VerticalStackLayout>
        <Label 
            Text="Welcome to .NET MAUI!"
            VerticalOptions="Center" 
            HorizontalOptions="Center" />
    </VerticalStackLayout>
</mauiPopup:BasePopupPage>
PopupPage.xaml.cs
using MauiPopup.Views;
namespace MauiPopupDemo;
public partial class PopupPage : BasePopupPage
{
	public PopupPage()
	{
		InitializeComponent();
	}
}


How to display Popup
MauiPopup.PopupAction.DisplayPopup(new PopupPage());
How to close Popup
MauiPopup.PopupAction.ClosePopup();

Display Popup that returning string value
string result = await MauiPopup.PopupAction.DisplayPopup(new PopupPage());
Now Pass String Value on ClosePopup Method
PopupAction.ClosePopup("hi");

Display Popup that returning other then string value
bool result = await MauiPopup.PopupAction.DisplayPopup<boo>(new PopupPage());
Now Pass Bool Value on ClosePopup Method
PopupAction.ClosePopup(true);


How to get value on popup close.

Pass Any Type of value in this method.
PopupAction.ClosePopup("hi");
To Get String Value
string result = await MauiPopup.PopupAction.DisplayPopup(new PopupPage());
To Get Other Type of Value
string result = await MauiPopup.PopupAction.DisplayPopup<int>(new PopupPage());
string result = await MauiPopup.PopupAction.DisplayPopup<bool>(new PopupPage());
string result = await MauiPopup.PopupAction.DisplayPopup<AnyTypeOfClass>(new PopupPage());

Implementation Video





Friday 2 September 2022

Create Button Control With Progress Bar (Activity Indicator) In .NET MAUI / Xamarin

This video about creating Button Control With Progress Bar (Activity Indicator) In .NET MAUI / Xamarin. 
Disable Button On Click Until Activity Indicator IsRunning Property Set to False.

GitHub URL : https://github.com/mistrypragnesh40/ButtonControlWithProgressbar


Popular Posts