Category / Section
How to add SfPopupLayout to another view instead of root view of a page
1 min read
SfPopupLayout can be added inside any layout. Only think we have to consider is popup layout platform render initialization if it is not root view of a page. Refer the link to know more about SfPopupLayout platform render initialization.
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sfPopup="clr-namespace:Syncfusion.XForms.PopupLayout;assembly=Syncfusion.SfPopupLayout.XForms" mc:Ignorable="d" x:Class="Popup.MainPage"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="50"/> </Grid.RowDefinitions> <sfPopup:SfPopupLayout x:Name="popUpLayout" Grid.Row="0"> <sfPopup:SfPopupLayout.PopupView> <sfPopup:PopupView HeightRequest="230" HeaderTitle="Popup view" ShowFooter="False"> <sfPopup:PopupView.ContentTemplate> <DataTemplate> <StackLayout Padding="10"> <Label Text="SfPopupLayout is loaded inside xamarin forms Grid" WidthRequest="260" BackgroundColor="White" HorizontalOptions="FillAndExpand" /> </StackLayout> </DataTemplate> </sfPopup:PopupView.ContentTemplate> </sfPopup:PopupView> </sfPopup:SfPopupLayout.PopupView> <sfPopup:SfPopupLayout.Content> <StackLayout x:Name="mainLayout"> <Button x:Name="clickToShowPopup" Text="ClickToShowPopup" VerticalOptions="Start" HorizontalOptions="FillAndExpand" Clicked="Button_Clicked" /> </StackLayout> </sfPopup:SfPopupLayout.Content> </sfPopup:SfPopupLayout> </Grid> </ContentPage>