is there way to pass value in Rg.Plugin.Popup popupNavigation?

Issue

is there way to pass value in Rg.Plugin.Popup popupNavigation?

I have a page, with a button. if clicked, I want to open custom popup page, with passing a ID value

CustomPopupPage _CustomPopupPage  new CustomPopupPage();
PopupNavigation.Instance.Pushing + (sender, e) > Debug.WriteLine($"[Popup] Pushing: {e.Page.GetType().Name}");

var ID  "5";
await PopupNavigation.Instance.PushAsync(_CustomPopupPage);

custompopuppage class – here i want Get the ID and do something with it

    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class CustomPopupPage : Rg.Plugins.Popup.Pages.PopupPage
    {
     ...
    }

Solution

As Jason’s reply, you can pass value in Popup page’s constructor, For example, this is the Popup Page.

 public partial class popup1 : PopupPage
{
    string parameter;
    public popup1(string str)
    {
        InitializeComponent();
      //get pass value from contentpage,
        parameter  str;
    } 
}

Pass value from ContentPage.

  private async void btnPopupButton_Clicked(object sender, EventArgs e)
    {

        await PopupNavigation.Instance.PushAsync(new popup1("parameter Id"));
    }

Answered By – Cherry Bu – MSFT

Leave a Comment