SfPopupLayout's content doesn't show within ContentView

I have a ContentPage with some controls and I made a custom control (using ContentView), this custom control has a SfDataGrid and I need to show a modal popup with actions when the user tap any row. This behaviour is done fine using the SfPopupLayout directly in the ContentPage, but when I want to use it inside of ContentView, the page stay white (nothing happens) like if the control have IsVisible=false, the Content is not shown.

What I missing?



ProductTemplate custom control:

<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
             xmlns:helpers="clr-namespace:Transportation.Helpers"
             xmlns:controls="clr-namespace:Transportation.Controls"
             xmlns:combobox="clr-namespace:Syncfusion.XForms.ComboBox;assembly=Syncfusion.SfComboBox.XForms"
             xmlns:syncfusion="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms"
             xmlns:inputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
             xmlns:datepicker="clr-namespace:Syncfusion.XForms.Pickers;assembly=Syncfusion.SfPicker.XForms"
             xmlns:sfPopup="clr-namespace:Syncfusion.XForms.PopupLayout;assembly=Syncfusion.SfPopupLayout.XForms"
             x:Class="Transportation.Controls.ProductTemplate">
    <sfPopup:SfPopupLayout x:Name="popupLayout">
        <sfPopup:SfPopupLayout.Content>
            <StackLayout>
..... my controls here
</sfPopup:SfPopupLayout.Content>

        <sfPopup:SfPopupLayout.PopupView>
<sfPopup:PopupView>
                <sfPopup:PopupView.ContentTemplate>
                    <DataTemplate>
                        <StackLayout Padding="30,30,30,20">
                            <Button
                                x:Name="btnEditar"
                                Clicked="btnEditar_Clicked"
                                Text="{helpers:Translate Editar}">
                                <Button.ImageSource>
                                    <FontImageSource
                                                FontFamily="MaterialDesignIcons"
                                                Glyph="{x:Static helpers:MaterialDesignIcons.PlaylistEdit}"
                                                Size="23"
                                                Color="{StaticResource ButtonColor}" />
                                </Button.ImageSource>
                            </Button>

                            <BoxView HeightRequest="1" Color="{StaticResource ButtonColor}" />

                            <Button
                                        x:Name="btnEliminar"
                                        Clicked="btnEliminar_Clicked"
                                        Text="{helpers:Translate Eliminar}">
                                <Button.ImageSource>
                                    <FontImageSource
                                                FontFamily="MaterialDesignIcons"
                                                Glyph="{x:Static helpers:MaterialDesignIcons.DeleteForever}"
                                                Size="23"
                                                Color="{StaticResource ButtonColor}" />
                                </Button.ImageSource>
                            </Button>
                        </StackLayout>
                    </DataTemplate>
                </sfPopup:PopupView.ContentTemplate>
            </sfPopup:PopupView>
        </sfPopup:SfPopupLayout.PopupView>
    </sfPopup:SfPopupLayout>
</ContentView>




Page.xaml (using tabs, I tested in another single Page and the result is the same):

<tabView:SfTabItem.Content>
                    <ScrollView>
                        <StackLayout >
                            <controls:ProductTemplate x:Name="Detail" />
                        </StackLayout>
                    </ScrollView>
                </tabView:SfTabItem.Content>
            </tabView:SfTabItem>



Is it possible to use SfPopupLayout inside of a ContentView? I couldn't use it because the PopupView.ContentTemplate is not shown in the Page that invoke the ContentView, in the code in the first post I show the xaml that I'm using.

If I use the popup inside of a Page directly, it works fine, but I want to use the SfPopupLayout in a custom control (ContentView), that content simply doesn't show them.

1 Reply 1 reply marked as answer

KK Karthikraja Kalaimani Syncfusion Team November 10, 2020 07:22 AM UTC

Hi Christian,

Based on the provided code snippet, we have used SfPopuplayout inside of ContentView like custom control and loaded that ContentView on SfTabView. In our side the SfPopupLayout.Content and SfPopuplayout.PopupView.ContentTemplate views loading perfectly. We have attached tested sample and screenshot for your reference.

We suspect that binding context didn’t initialized for the views which is in Content of the SfPopupLayout and ContentTemplate of the popupview in your side. So, only the desired view is not created for that view which is in Content of the SfPopuplayout. So, you can also check by loading Label or Forms Button on SfPopupLayout.Content and SfPopupLayout.PopupView.ContentTemplate. If, the button and label is visible, please check the binding context is initialized or not for your custom controls.

If, the binding context is also initialized and not visible in the view, please set the height request and width request for the custom controls which is in ContentTemplate of the popupview and Content of the SfPopupLayout and let us know the details.

If, the binding context is initialized, height and width request also applied to Custom controls which is in ContentTemplate of the PopupView and still not visible in the view, please modify the below attached sample and revert us back with clear replication. Because it will help us to provide a better solution asap.

Working Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/Popup_Demo481106759.zip


ScreenShot :

 
 



Note : We have checked with SfPopuplayout v18.3.0.47 and Xamarin Forms v4.7.0.968 

Regards,
Karthik Raja 


Marked as answer
Loader.
Up arrow icon