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. Image for the cookie policy date
close icon

Swipe not working on IOS

Here is the XAML I'm using for SF Data Grid. I see this code is working fine on Android. I see swipe action is showing the elements i need. But, this is not working on IOS. Do you see any issues / recommend changes to XAML, to make it work on IOS?

<?xml version="1.0" encoding="UTF-8" ?>
<ContentView x:Class="SpsMobile.Pcl.Views.Customers.ContactGridView"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:abstractions="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
             xmlns:converters1="clr-namespace:SpsMobile.Converters;assembly=SpsMobile.Pcl"
             xmlns:customRenderer="clr-namespace:SpsMobile.Pcl.Renderers;assembly=SpsMobile.Pcl"
             xmlns:misc="clr-namespace:SpsMobile.Pcl.ViewModels.Misc;assembly=SpsMobile.Pcl"
             xmlns:sfgrid="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms"
             xmlns:statics="clr-namespace:SpsMobile.Statics;assembly=SpsMobile.Pcl"
             xmlns:statics1="clr-namespace:SpsMobile.Pcl.Statics;assembly=SpsMobile.Pcl">

    <misc:CustomLayout x:Name="custumLayout">

        <sfgrid:SfDataGrid x:Name="dataGrid"
                           AllowPullToRefresh="false"
                           AllowSwiping="true"
                           AutoGenerateColumns="false"
                           ColumnSizer="Star"
                           GridTapped="dataGrid_GridTapped"
                           ItemsSource="{Binding}"
                           MaxSwipeOffset="150">
            <sfgrid:SfDataGrid.Resources>
                <ResourceDictionary>
                    <converters1:StringToIsVisibleConverter x:Key="StringToIsVisibleConverter" />
                </ResourceDictionary>
            </sfgrid:SfDataGrid.Resources>
            <sfgrid:SfDataGrid.RowHeight>
                <OnPlatform x:TypeArguments="x:Double"
                            Android="65"
                            iOS="70" />
            </sfgrid:SfDataGrid.RowHeight>
            <sfgrid:SfDataGrid.Columns>
                <!--<sfgrid:GridTextColumn MappingName="FullName" />-->
                <sfgrid:GridTemplateColumn HeaderText="" MappingName="FullName">
                    <sfgrid:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Grid>
                                <RelativeLayout Margin="10">
                                    <Label FontAttributes="Bold"
                                           LineBreakMode="TailTruncation"
                                           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                                  Property=Height,
                                                                                                  Factor=0.5}"
                                           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                                 Property=Width,
                                                                                                 Factor=1.0}"
                                           Text="{Binding FullName}"
                                           TextColor="{x:Static statics:Palette._002}">
                                        <Label.FontSize>
                                            <OnPlatform x:TypeArguments="x:Double"
                                                        Android="17"
                                                        iOS="19" />
                                        </Label.FontSize>
                                        <Label.FontFamily>
                                            <OnPlatform x:TypeArguments="x:String"
                                                        Android="OpenSans"
                                                        iOS="OpenSans-Semibold" />
                                        </Label.FontFamily>
                                    </Label>

                                    <Label FontFamily="FontAwesome"
                                           HorizontalOptions="End"
                                           IsVisible="{Binding IsFavorite}"
                                           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                                  Property=Height,
                                                                                                  Factor=0.5}"
                                           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                                 Property=Width,
                                                                                                 Factor=1.0}"
                                           Text="{x:Static statics1:FontAwesome.FaStar}"
                                           TextColor="{x:Static statics:Palette._002}">

                                        <Label.FontSize>
                                            <OnPlatform x:TypeArguments="x:Double"
                                                        Android="17"
                                                        iOS="19" />
                                        </Label.FontSize>
                                        <Label.FontAttributes>
                                            <OnPlatform x:TypeArguments="FontAttributes" Android="Bold" />
                                        </Label.FontAttributes>

                                    </Label>

                                    <Label FontAttributes="Bold"
                                           FontFamily="OpenSans"
                                           LineBreakMode="TailTruncation"
                                           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                                  Property=Height,
                                                                                                  Factor=0.5}"
                                           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                                 Property=Width,
                                                                                                 Factor=1.0}"
                                           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                                             Property=Height,
                                                                                             Factor=0.5}"
                                           Text="{Binding Title}"
                                           TextColor="{x:Static statics:Palette._003}">
                                        <Label.FontSize>
                                            <OnPlatform x:TypeArguments="x:Double"
                                                        Android="14"
                                                        iOS="15" />
                                        </Label.FontSize>
                                    </Label>

                                </RelativeLayout>
                            </Grid>
                        </DataTemplate>
                    </sfgrid:GridTemplateColumn.CellTemplate>
                    <sfgrid:GridTemplateColumn.HeaderCellTextSize>
                        <OnPlatform x:TypeArguments="x:Double"
                                    Android="0"
                                    iOS="0" />
                    </sfgrid:GridTemplateColumn.HeaderCellTextSize>
                </sfgrid:GridTemplateColumn>

            </sfgrid:SfDataGrid.Columns>

            <sfgrid:SfDataGrid.RightSwipeTemplate>
                <DataTemplate>
                    <Grid BackgroundColor="{x:Static statics:Palette._006}">

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="60" />
                            <ColumnDefinition Width="60" />
                            <ColumnDefinition Width="10" />
                        </Grid.ColumnDefinitions>

                        <abstractions:CircleImage Grid.Column="1"
                                                  FillColor="{x:Static statics:Palette._002}"
                                                  HeightRequest="45"
                                                  HorizontalOptions="Center"
                                                  IsVisible="{Binding PhoneNumber,
                                                                      Converter={StaticResource StringToIsVisibleConverter}}"
                                                  VerticalOptions="Center"
                                                  WidthRequest="45">

                            <abstractions:CircleImage.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding DialNumberCommand}" CommandParameter="{Binding PhoneNumber}">
                                    <TapGestureRecognizer.NumberOfTapsRequired>
                                        <OnPlatform x:TypeArguments="x:Int32"
                                                    Android="1"
                                                    iOS="1" />
                                    </TapGestureRecognizer.NumberOfTapsRequired>
                                </TapGestureRecognizer>
                            </abstractions:CircleImage.GestureRecognizers>

                        </abstractions:CircleImage>

                        <Label Grid.Column="1"
                               FontFamily="FontAwesome"
                               FontSize="20"
                               HorizontalOptions="Center"
                               IsVisible="{Binding PhoneNumber,
                                                   Converter={StaticResource StringToIsVisibleConverter}}"
                               Text="{x:Static statics1:FontAwesome.FaPhone}"
                               TextColor="White"
                               VerticalOptions="Center">

                            <Label.GestureRecognizers>

                                <TapGestureRecognizer Command="{Binding DialNumberCommand}" CommandParameter="{Binding PhoneNumber}">
                                    <TapGestureRecognizer.NumberOfTapsRequired>
                                        <OnPlatform x:TypeArguments="x:Int32"
                                                    Android="1"
                                                    iOS="1" />
                                    </TapGestureRecognizer.NumberOfTapsRequired>
                                </TapGestureRecognizer>
                            </Label.GestureRecognizers>

                        </Label>

                        <abstractions:CircleImage Grid.Column="2"
                                                  FillColor="{x:Static statics:Palette._002}"
                                                  HeightRequest="45"
                                                  HorizontalOptions="Center"
                                                  IsVisible="{Binding Email,
                                                                      Converter={StaticResource StringToIsVisibleConverter}}"
                                                  VerticalOptions="Center"
                                                  WidthRequest="45">

                            <abstractions:CircleImage.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding SendEmailCommand}" CommandParameter="{Binding Email}">
                                    <TapGestureRecognizer.NumberOfTapsRequired>
                                        <OnPlatform x:TypeArguments="x:Int32"
                                                    Android="1"
                                                    iOS="1" />
                                    </TapGestureRecognizer.NumberOfTapsRequired>
                                </TapGestureRecognizer>
                            </abstractions:CircleImage.GestureRecognizers>

                        </abstractions:CircleImage>

                        <Label Grid.Column="2"
                               FontFamily="FontAwesome"
                               FontSize="20"
                               HorizontalOptions="Center"
                               IsVisible="{Binding Email,
                                                   Converter={StaticResource StringToIsVisibleConverter}}"
                               Text="{x:Static statics1:FontAwesome.FaEnvelope}"
                               TextColor="White"
                               VerticalOptions="Center">

                            <Label.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding SendEmailCommand}" CommandParameter="{Binding Email}">
                                    <TapGestureRecognizer.NumberOfTapsRequired>
                                        <OnPlatform x:TypeArguments="x:Int32"
                                                    Android="1"
                                                    iOS="1" />
                                    </TapGestureRecognizer.NumberOfTapsRequired>
                                </TapGestureRecognizer>
                            </Label.GestureRecognizers>
                        </Label>
                    </Grid>
                </DataTemplate>
            </sfgrid:SfDataGrid.RightSwipeTemplate>

        </sfgrid:SfDataGrid>

    </misc:CustomLayout>

</ContentView>

3 Replies

DS Divakar Subramaniam Syncfusion Team December 5, 2016 11:56 AM UTC

Hi Kishore, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query and we were not able to reproduce the reported issue on our side. We have prepared a sample based on your code snippet and the swiping was working fine.  
For your reference, we have attached our working sample and you can download the same from the below link. 
 
If the issue still persists on your side, then please do revert us with modified sample reproducing the issue which will help us to serve you better. 
 
Regards, 
Divakar. 



KI Kishore December 8, 2016 10:26 PM UTC

Thanks for the demo. I was able to get the swipe running, after adding SFDataGridRender.Init() to IOS project. Now, I see a different issue.

To better articulate the problem and show you the issue I'm facing, i have prepared a demo solution. 

Please download the solution from 

https://cdw-my.sharepoint.com/personal/alefish_cdw_com/_layouts/15/guestaccess.aspx?guestaccesstoken=Ol4L%2b2bBT0gq9PpoRze8sEfbmpEQ3fpnVCKQDKPHTZA%3d&docid=0f93da056ca254980b0d9f86cbbdf919e&rev=1&expiration=2017-02-06T21%3a49%3a03.000Z

To use the demo, run it on iOS device (Iphone preferred). Don't try in emulator. It appears to be working most of the times in Emulator. I was able to repro issue on device multiple times.

When you open the App, 
1. Select "SPS Mobile" menu item. 
2. From left menu options select customers.
3. from Customer List, select any of the customers.
4. From the Tabs, Select Contacts
5. From Contacts List, select a contact
6. try to swipe on a contact from right. You will be able to see phone / email options. 

I attached screenshots of app, corresponding to each step explained above.

When i try to scroll through list and try to swipe on a contact, i see null reference exception. (Screenshot - Error1).

I attached detailed stack trace in Screenshot-Error2.

Can you let me know resolution for this error?






Attachment: SPS_52fe4168.zip


DS Divakar Subramaniam Syncfusion Team December 9, 2016 12:23 PM UTC

Hi Kishore, 
 
We have checked your query and most probably this will be a defect on our side.  
A support incident to track the status of your query has been created under your account. Please log on to our support website to check for further updates
 
   
 
Regards, 
Divakar. 


Loader.
Live Chat Icon For mobile
Up arrow icon