We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Custom function with SfPopUp how wait ???

Hi,

I´m create custom function that have screen interaction, to permit user define interaction from cell.

But when made SfPopUp.Show() , this can´t wait SfPopUp end to return and continue program. Custom Function ended before SfPopUp

Thanks in advance for any help.

Custom function Example :

public string InputRB(string args)
        {
            strReturn = String.Empty;
            var splitArgs = args.Split(new char[] { CalcEngine.ParseArgumentSeparator }); 

            DataTemplate templateview = new DataTemplate(() =>
            {
                StackLayout slMain = new StackLayout();
                SfRadioGroup radioGroup = new SfRadioGroup();
                foreach (var item in splitArgs)
                {
                   SfRadioButton rb = new SfRadioButton();
                    rb.Text = item;
                    rb.StateChanged += RadioButton_StateChanged;
                    radioGroup.Children.Add(rb);
                }
                slMain.Children.Add(radioGroup);
                return slMain;
            });


            PopUpInput ppcnt = new PopUpInput();
            SfPopupLayout pplt = ppcnt.Content as SfPopupLayout;
            pplt.PopupView.ContentTemplate = templateview;
            pplt.Show(); /* returning from SFPopUp without wait SFPopUp close. */
            return strReturn;
        }
        private void RadioButton_StateChanged(object sender, StateChangedEventArgs e)
        {
            strReturn = (sender as SfRadioButton).Text;
          
        }

6 Replies

VR Vigneshkumar Ramasamy Syncfusion Team November 8, 2018 12:41 PM UTC

Hi Carbonete,  
  
Thanks for using Syncfusion support.  
                                                                 
We have checked your query. In that, we have loaded the radio button as content in popup, while clicking the radio button the popup does not close. If your try to perform any action while popup in the view, the popup will close, it is the behavior of the popup. We have prepared the sample based on your requirement and attached the same for your reference. You can download the sample from the below link.    
  
 
Please let us know if this helpful.  
 
Regards,  
Vigneshkumar R 



CA Carbonete replied to Vigneshkumar Ramasamy November 8, 2018 05:08 PM UTC

Hi Carbonete,  
  
Thanks for using Syncfusion support.  
                                                                 
We have checked your query. In that, we have loaded the radio button as content in popup, while clicking the radio button the popup does not close. If your try to perform any action while popup in the view, the popup will close, it is the behavior of the popup. We have prepared the sample based on your requirement and attached the same for your reference. You can download the sample from the below link.    
  
 
Please let us know if this helpful.  
 
Regards,  
Vigneshkumar R 


Hi,

Sorry but this is not the answer . You not put any instruction after   popupLayout.Show();

If you make this , you see instruction execute and popup continue open.

private void ClickToShowPopup_Clicked(object sender, EventArgs e)
        {
            popupLayout.Show();
            string s = " this execute and popup still open";
        }

In my sample.

return strReturn;

  executed and popup not closed.

I  want instruction after Show execute only after  popup  closed.

Remenber that popup is showed inside a Calculate function and if not wait popup close, function ended and return no value.

Thanks for your atention.






FR FrozDark November 8, 2018 07:42 PM UTC

Make you callback async and do this

private async void ClickToShowPopup_Clicked(object sender, EventArgs e)
        {
                popupLayout.IsOpen = true;
                while (popupLayout.IsOpen)
                {
                     await Task.Delay(100);
                }
               string s = " this execute AFTER popup closed";
        }


VR Vigneshkumar Ramasamy Syncfusion Team November 9, 2018 12:27 PM UTC

Hi Carbonete,  
  
We are sorry for the inconvenience caused.  
  
We have checked your query. In that, if you want to perform the action after popup close. You can achieve your requirement by using SfPopupLayout.Closed event. We have prepared the sample base on your requirement and attached for your reference you can download the same from below link.  
  
 
You can perform your actions “string s = " this execute AFTER popup closed";” inside the popup closed event. 
 
Please let us know if this helpful. 
 
Regards,  
Vigneshkumar R 



CA Carbonete replied to Vigneshkumar Ramasamy November 9, 2018 12:43 PM UTC

Hi Carbonete,  
  
We are sorry for the inconvenience caused.  
  
We have checked your query. In that, if you want to perform the action after popup close. You can achieve your requirement by using SfPopupLayout.Closed event. We have prepared the sample base on your requirement and attached for your reference you can download the same from below link.  
  
 
You can perform your actions “string s = " this execute AFTER popup closed";” inside the popup closed event. 
 
Please let us know if this helpful. 
 
Regards,  
Vigneshkumar R 


Sorry, i think you can't understand or i can´t be clear in my need.  
I need a synchronous PopUp.

I need a behavior like  to win32 Messagebox or Win32 OpenFIledialog .

Next intruction not executed until Dialog closed. 

Examples :

https://docs.microsoft.com/en-us/dotnet/api/microsoft.win32.openfiledialog?view=netframework-4.7.2

https://docs.microsoft.com/en-us/windows/desktop/dlgbox/using-dialog-boxes


VR Vigneshkumar Ramasamy Syncfusion Team November 12, 2018 10:35 AM UTC

 
Hi Carbonete,  
  
Thanks for your update.  
  
We have checked your query. You can achieve your requirement by setting  the IsOpen true and false. In our sample we have show popup in button click and close the popup with delay, after close the popup the DisplayAlert will show . we have attached the sample for your reference. You can download the same from the below link.  
   
 
Please let us know if this helpful. 
 
Regards,  
Vigneshkumar R 


Loader.
Live Chat Icon For mobile
Up arrow icon