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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Show Popup without clicking a button

Thread ID:

Created:

Updated:

Platform:

Replies:

143076 Mar 4,2019 09:35 AM UTC Mar 5,2019 11:25 AM UTC Xamarin.Forms 2
loading
Tags: SfPopup
Temitope
Asked On March 4, 2019 09:35 AM UTC

i have this code 
 ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:border="clr-namespace:Syncfusion.XForms.Border;assembly=Syncfusion.Core.XForms"
xmlns:inputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:button="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
             xmlns:syncfusion="clr-namespace:Syncfusion.SfBusyIndicator.XForms;assembly=Syncfusion.SfBusyIndicator.XForms"
             xmlns:sfPopup="clr-namespace:Syncfusion.XForms.PopupLayout;assembly=Syncfusion.SfPopupLayout.XForms"
             x:Class="WGBSync.Views.Register" BackgroundImage="bg.png" NavigationPage.HasBackButton="False" NavigationPage.HasNavigationBar="False">
    <sfPopup:SfPopupLayout x:Name="popupme" >
        <sfPopup:SfPopupLayout.Padding>
            <OnPlatform x:TypeArguments="Thickness">
                <On Platform="iOS" Value="0, 20, 0, 0" />
            </OnPlatform>
        </sfPopup:SfPopupLayout.Padding>
        <sfPopup:SfPopupLayout.Content>
            <StackLayout x:Name="mainLayout">
                <Grid>
</Grid>
  </sfPopup:SfPopupLayout.Content>
   </sfPopup:SfPopupLayout >


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

            
                   
                   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";

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

Temitope
Replied On March 4, 2019 01:02 PM UTC

please help

Subburaj Pandian Veluchamy [Syncfusion]
Replied On 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, 
 
[C#] 
 
private async void showpopup() 
        { 
            await Task.Delay(1000); 
            popupLayout.Show(); 
        } 
 

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. 
 
Regards,
Subburaj Pandian V 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;