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

Show Popup without clicking a button

i have this code 
 ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             x:Class="WGBSync.Views.Register" BackgroundImage="bg.png" NavigationPage.HasBackButton="False" NavigationPage.HasNavigationBar="False">
    <sfPopup:SfPopupLayout x:Name="popupme" >
            <OnPlatform x:TypeArguments="Thickness">
                <On Platform="iOS" Value="0, 20, 0, 0" />
            <StackLayout x:Name="mainLayout">
   </sfPopup:SfPopupLayout >

and this c# code
     public  void popup(string message, int type, string header)

                   contentTemplateView = new DataTemplate(() =>
                        popupContent = new Label
                            Text = message,
                            TextColor = type == 1 ? Color.Green : Color.Red,
                            BackgroundColor = Color.White,
                            HorizontalTextAlignment = TextAlignment.Center,
                        return popupContent;
                     headerTemplateView = new DataTemplate(() =>
                        popupheader = new Label
                            Text = header,
                            FontAttributes = FontAttributes.Bold,
                            BackgroundColor = type == 1 ? Color.Green : Color.Red,
                            FontSize = 16,
                            TextColor = Color.White,
                            HorizontalTextAlignment = TextAlignment.Center,
                            VerticalTextAlignment = TextAlignment.Center
                        return popupheader;
                    popupme.PopupView.HeaderTemplate = headerTemplateView;
                    popupme.PopupView.ContentTemplate = contentTemplateView;
                    popupme.PopupView.AppearanceMode = AppearanceMode.OneButton;
                    popupme.PopupView.AnimationMode = AnimationMode.Zoom;
                    popupme.PopupView.AcceptButtonText = "OK";

            catch(Exception ex)
 i want to call popup like this on registration success popup("Registration Successful",1,"Sucess") on the click of register button.
am getting noSuchmethodError

2 Replies

TE Temitope March 4, 2019 01:02 PM UTC

please help

SP Subburaj Pandian Veluchamy Syncfusion Team March 5, 2019 11:25 AM UTC

Hi Temitope, 
Thank you for contacting Syncfusion support. 
Based on the provided information, your requirement of “Showing Popup layout as a content in the page without any click operation” can be achieved by setting the Popup layout as content in the concern page. And if your requirement is to render the Popup without any function like Button click, you can call Show method in the Popup with the delay.  
Please refer the following code example, 
private async void showpopup() 
            await Task.Delay(1000); 

We have prepared sample by setting Popup as content in the ContentPage and shown the Popup directly without any click operation. Please find the sample by the following link, 
We hope this helps. Please let us know, if you have any query. 
Subburaj Pandian V 

Live Chat Icon For mobile
Up arrow icon