Hello,
This issue is related to the RGPopup.Maui, after selecting the image from the gallery, then you cannot pop up a page. I tried with pop up a page without any other parameters. it still cannot pop up as well.
But if you do not select image from the gallery, you can pop up it successfully without any other parameters. You can report this issue in this RGPopup.Maui github repo.
You installed .NET MAUI Community Toolkit
, you can use Popup directly, I tested in your demo, it is working. But you need to make some changes for your UploadImagePopupPage.
Firstly open your UploadImagePopupPage.xaml
, change the popup type to toolkit:Popup
.
<toolkit:Popup
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="Listpm.Pages.UploadImagePopupPage">
Then, open your UploadImagePopupPage.xaml.cs
, change the popup type and set the image source directly in the constructor. As note: Popup do not have onappearing method and cannot displayAlert directly.
using CommunityToolkit.Maui.Views;
namespace Listpm.Pages
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class UploadImagePopupPage : Popup
{
string picturepath;
public UploadImagePopupPage(string path)
{
InitializeComponent();
picturepath = path;
popupimage.Source = ImageSource.FromFile(picturepath);
}
}
}
In the end, you can popup this page by this.ShowPopup
.
public async void UploadButtonClicked(object sender, EventArgs e)
{
this.ShowPopup((new UploadImagePopupPage(attachmentList[0].path)));
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.