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

Popup closes immediatly when opened in OnAppearing


I've created a method to show a modal message box with SfPopupLayout in code. This Popup is opened sometimes after popping a page from the navigationstack. I handle this in the OnAppearing method of the now top page of the navigationstack. Unfortunatly, the popup is shown for just a fraction of a second and then removed.

I haven't found any later event to handle this. Does anyone have an idea how to keep that popup open or where the appropriate position for the call would be?

The code I'm using for the popup:

public void ShowMessageBox(
      string sMessage,
      string sOkText,
      Command okCommand = null,
      string sCancelText = null,
      Command cancelCommand = null)
      var msgBox = new SfPopupLayout();

      msgBox.PopupView.AcceptButtonText = sOkText;
        msgBox.PopupView.AppearanceMode = AppearanceMode.TwoButton;
        msgBox.PopupView.DeclineButtonText = sCancelText;

      if (okCommand != null)
        msgBox.PopupView.AcceptCommand = okCommand;

      if (cancelCommand != null)
        msgBox.PopupView.DeclineCommand = cancelCommand;

      msgBox.PopupView.PopupStyle.CornerRadius = 10;
      msgBox.PopupView.ShowHeader = false;
      msgBox.PopupView.ShowCloseButton = false;
      msgBox.PopupView.AutoSizeMode = AutoSizeMode.Height;

      var contentTemplateView = new DataTemplate(() =>
         var lbl = new Label();
         lbl.Margin = new Thickness(5, 10);
         lbl.Text = sMessage;
         lbl.LineBreakMode = LineBreakMode.WordWrap;
         lbl.WidthRequest = 260;

         var stack = new StackLayout();
         return stack;

      msgBox.PopupView.ContentTemplate = contentTemplateView;

      /// Makes the Message modal
      msgBox.StaysOpen = true;
      msgBox.IsOpen = true;

5 Replies

BS Balasubramani Sundaram Syncfusion Team August 30, 2019 12:00 PM

Hi Martin,  
Thank you for contacting Syncfusion support.     

Based on your code snippet we have checked the issue “Popup closes immediately when opened in On Appearing”. We have checked the issue in UWP platform we didn’t get any issue its working fine in our side but when we have checked in android platform, we faced a same issue when we forth back to pervious page within the Navigation Page. We have prepared a sample based on your provided details please confirm whether you are trying to convey the same this will be more help us to provide a solution at earliest. 
Please refer the following sample, 
Balasubramani Sundaram. 

MA Martin September 3, 2019 12:31 AM


while in my case I've routed everything into the ViewModel and I actively pop the second page, the behaviour in your sample project when coming back to the first page is exactly the same as what I am experiencing. I found a workaround by starting a thread that delays for 500 ms before opening the popup, but not needing this rather hacky solution would be nice.


BS Balasubramani Sundaram Syncfusion Team September 4, 2019 03:59 AM

Hi Martin,  
Thank you for the update.  
We have already fixed the issue “Popup closes immediately when opened in On Appearing” and the issue fix will be included in our upcoming 2019 Volume 3 Beta release which is expected to be roll out by mid of September 2019. Please let us know if you required a patch earlier.   
We appreciate your patience until then.   
Balasubramani Sundaram. 

LM Luke McNally May 6, 2020 11:56 PM

Please can you confirm the bug ID and what build the fix actually went into? We're running and are still experiencing the issue on Android. I've reviewed the release notes for 2020 Volume 1 and can't see any mention of it being fixed in there.

KK Karthikraja Kalaimani Syncfusion Team May 8, 2020 04:46 AM

Hi Luke,

We have logged that bug as internally and included the fix in the version So only the we did not mention the bug in release update. Moreover, we have checked the reported issue in SfPopupLayout version and we could not able to reproduce the issue in our end and it is working fine as expected. Since we are not about your exact application scenario. So could you please reproduce the issue in the below attached sample and revert us back with clear replication procedure.

Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/Popup_Demo96799049-1530933884.zip

Karthik Raja 

Live Chat Icon For mobile
Up arrow icon