none
Problem with Rg.Plugin.Popup's CallbackEvent RRS feed

  • Question

  • Hi,

    I am trying to have a CallBackEvent for Rg.Plugin.Popup in my Xamarin PCL app using below:

    In the Popup:

    public event EventHandler<object> CallbackEvent;


    
    private void InvokeCallback()
    {
        CallbackEvent?.Invoke(this, anyObjectForResult);
    }

    In the Form:

    public void OnPopupUnitsCallback(object sender, System.EventArgs e)
    {
        App.Current.MainPage.DisplayAlert("Closed", "Successfully Added to your favorite.", "Ok");
    }
    
    async void btnConvertFrom_Clicked(object sender, System.EventArgs e)
    {
        var popupUnits = new PopupUnits();
        popupUnits.CallbackEvent += OnPopupUnitsCallback();
        await Navigation.PushPopupAsync(popupUnits);    
    }

    But I am getting:

    PopupUnits.xaml.cs(47,41,47,59): error CS0103: The name 'anyObjectForResult' does not exist in the current context
    Home.xaml.cs(193,41,193,61): error CS7036: There is no argument given that corresponds to the required formal parameter 'sender' of 'Home.OnPopupUnitsCallback(object, EventArgs)'
    Home.xaml.cs(193,13,193,63): error CS0029: Cannot implicitly convert type 'void' to 'System.EventHandler'

    How can I fix please…

    Thanks,
    Jassim


    Thursday, February 1, 2018 7:41 PM

All replies

  • Hi Jassim Rahma,

    Thank you for posting here.

    According to your question is more related to Xamarin, you could post a new thread in Xamarin forum for suitable support.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions. 

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 2, 2018 8:25 AM