Swipe don't work on SFDatagrid

Buen día,
 Estoy agregando la funcionalidad de Swipe para un data grid que estoy usando pero al momento de deslizar no pasa nada , consultando casos similares di con el siguiente proyecto, pero no lo puedo ejecutar

http://www.syncfusion.com/downloads/support/forum/123959/ze/SwipeSample1674893809 

El código de la vista :

<StackLayout Margin="0,0,0,0">

                    <syncfusionGrid:SfDataGrid x:Name="dataGrid"

                                           BackgroundColor="Black"

                   ItemsSource="{Binding Servicios}"

                 AllowResizingColumn="True"

                        AutoGenerateColumns="False"

                                           ColumnSizer="Star">

                        <syncfusionGrid:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns">

                            <syncfusionGrid:GridTextColumn HeaderText="Conductor"

                                   MappingName="NombreConductor" />

                            <syncfusionGrid:GridTextColumn HeaderText="Placa"

                                   MappingName="Placa" />

                            <syncfusionGrid:GridTextColumn MappingName="FechaHoraLlegada"

                                                       HeaderText="Fecha-Hora"/>

                            <syncfusionGrid:GridTextColumn HeaderText="Profesional"

                                   MappingName="NombreProfesional" />

                        </syncfusionGrid:SfDataGrid.Columns>

                        <syncfusionGrid:SfDataGrid.LeftSwipeTemplate>

                            <DataTemplate>

                                <Grid x:Name="leftSwipe" BackgroundColor="#009EDA">

                                    <Grid.ColumnDefinitions>

                                        <ColumnDefinition/>

                                        <ColumnDefinition/>

                                    </Grid.ColumnDefinitions>


                                    <Label Grid.Column="1"

                   Text ="Call"

                   HorizontalTextAlignment="Start"

                   VerticalTextAlignment="Center"

                   LineBreakMode ="NoWrap"

                   BackgroundColor="Transparent"

                   TextColor ="White" >

                                        <Label.GestureRecognizers>

                                            <TapGestureRecognizer

                        Tapped="OnCallTapGestureRecognizerTapped"

                        NumberOfTapsRequired="1" />

                                        </Label.GestureRecognizers>

                                    </Label>


                                </Grid>

                            </DataTemplate>

                        </syncfusionGrid:SfDataGrid.LeftSwipeTemplate>


                       

                    </syncfusionGrid:SfDataGrid>

                </StackLayout>



El codigo de la vista :

public partial class ListaServicios : ContentPage

    {


        private Image leftImage;


        private Image rightImage;


        private int swipedRowIndex;


        private FormsView formView;

        ServiciosSuraTurnos model;

        bool showing;


        public ListaServicios(ObservableCollection<ServiciosSuraTurnos> turnos,string tiempo, string ips)

        {

            InitializeComponent();

            BindingContext = new ListaServiciosViewModel(Navigation, turnos,tiempo,ips);

            //PropertyChanged += Swiping_PropertyChanged;

            //formView = new FormsView(dataGrid);

            //dataGrid.Children.Add(formView);

        }

        private void GoToHome(object sender, EventArgs e)

        {

            //await App.Current.MainPage.Navigation.PushModalAsync(new TableroInicial());

            Application.Current.MainPage = new Controls.TransitionNavigationPage(new LoginPage ());

        }

        private void image_BindingContextChanged(object sender, EventArgs e)

        {

            (sender as Image).Source = ImageSource.FromResource("SwipeSample.Icon.Settings1.png");

        }


        #region Event

        void OnSwipeStart(object sender, Syncfusion.SfDataGrid.XForms.SwipeStartedEventArgs e)

        {

            model = (ServiciosSuraTurnos)e.RowData;

            dataGrid.MaxSwipeOffset = (e.SwipeDirection == Syncfusion.SfDataGrid.XForms.SwipeDirection.Right) ? 200 : 300;

            //App.Current.MainPage.DisplayAlert(e.SwipeOffSet.ToString());

            App.Current.MainPage.DisplayAlert("ERROR", e.SwipeOffSet.ToString(), "Aceptar");

        }


        void OnSwipeEnded(object sender, Syncfusion.SfDataGrid.XForms.SwipeEndedEventArgs e)

        {

            showing = false;

        }


        async void OnCallTapGestureRecognizerTapped(object sender, EventArgs e)

        {

            //QueueServiceClient _queueServiceClient = new QueueServiceClient();

            //await _queueServiceClient.CallPatient(hold.QueueNumber);

        }


        void OnSwiping(object sender, SwipingEventArgs e)

        {

            if (e.SwipeDirection == Syncfusion.SfDataGrid.XForms.SwipeDirection.Left && e.SwipeOffSet < -150 && showing == false)

            {

                showing = true;

                //Device.BeginInvokeOnMainThread(() => Navigation.PushModalAsync(new ComplaintTabletMainView(hold.Mrn, hold.QueueNumber)));

            }

        }

}



1 Reply

SY Suthi Yuvaraj Syncfusion Team May 16, 2022 01:23 PM UTC

Hi Maicol Lopez,

We have checked the reported Query “Swipe don't work on SFDatagrid” , we would like to inform you that to enable Swiping in SfDatagrid , you need to set the AllowSwiping to true , Please refer the below code snippet and UG link.

Code snippet:

<sfgrid:SfDataGrid x:Name="dataGrid"

ItemsSource="{Binding OrdersInfo}"

AllowSwiping="True"

AllowResizingColumn="True"

AutoGenerateColumns="False"

ColumnSizer="Star">


UG Link: https://help.syncfusion.com/xamarin/datagrid/swiping

Also we have attached the sample for your reference , Please let us know if you need further assistance.

Regards,

Suthi Yuvaraj.


Loader.
Up arrow icon