how to move the popview when it is opened?

Hello, I want to move the popupview to do a swipe down to close action. But when I try to use the TranslationTo or translationY it doesn't work, even if I try to use it directly in the xaml, nothing happens. So that's my question, how could I change the popupview content position?


1 Reply

SV Suja Venkatesan Syncfusion Team April 1, 2022 01:59 PM UTC

Hi Felipe,


You can achieve your requirement “Swipe down to close action of SfPopupLayout” by setting AnimationMode property with value SlideOnBottom and adding Swipingesture to ContentTemplate of SfPopupView as like below code snippet.


Code snippets:

XAML

<sfPopup:SfPopupLayout x:Name="PopupLayout" >

            <sfPopup:SfPopupLayout.PopupView>

                <sfPopup:PopupView ShowHeader="False"

                                   ShowFooter="False"

                                   AnimationMode="SlideOnBottom">

                    <sfPopup:PopupView.ContentTemplate>

                        <DataTemplate>

                            <Grid>

                                <Label Text="Swipe_Down_to_Close"/>

                                <Grid.GestureRecognizers>

                                    <SwipeGestureRecognizer Direction="Down" Swiped="SwipeGestureRecognizer_Swiped"/>

                                </Grid.GestureRecognizers>

                            </Grid>

                        </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>


C#

private void Button_Clicked(object sender, EventArgs e)

{

   PopupLayout.Show();

}

private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)

{

   PopupLayout.Dismiss();

}


Please refer our user guidelines documentation regarding AnimationMode in the below link:

UG link: https://help.syncfusion.com/xamarin/popup/popup-animations


We have attached a simple SfPopup sample based on requirement for your reference. Please let us know if you need any further assistance.


Regards,

Suja


Attachment: GettingStarted_38720810.zip

Loader.
Up arrow icon