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

Swipe feature can not be use with Grid Template Column

Hi I`m currently facing a problem in using Grid Template Column together with Swipe feature, when I swipe the row it keep saying that "Exception has been thrown by the target of an invocation."

here is my code

<sfgrid:SfDataGrid x:Name="dataGrid"
                       AllowSwiping="True"
                       SwipeStarted="OnSwipeStart"
                       SwipeEnded="OnSwipeEnded"
                       Swiping="OnSwiping"
                       HeaderRowHeight="0"
                       AutoGenerateColumns="False"
                       ColumnSizer="Star"
                       ItemsSource="{Binding ItemsSource}">

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

        <sfgrid:GridTemplateColumn HeaderText=""
                                   MappingName="PatientPic">
          <sfgrid:GridTemplateColumn.CellTemplate>
            <DataTemplate>
              <Grid>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0"
                       Source="{Binding PatientPic, Converter={StaticResource Convert}}"/>
                <Label Grid.Column="1"
                       Text="{Binding QueueEntryDto.PatientName}" TextColor="Black"
                       XAlign="Center" YAlign="Center"/>
              </Grid>
            </DataTemplate>
          </sfgrid:GridTemplateColumn.CellTemplate>
        </sfgrid:GridTemplateColumn>
        <!--<sfgrid:GridTextColumn MappingName="Mrn" />
        <sfgrid:GridTextColumn MappingName="PatientName" />
        <sfgrid:GridTextColumn MappingName="VisitId" />-->
      </sfgrid:SfDataGrid.Columns>

      <!--Left Swipe Template-->
      <sfgrid: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>
      </sfgrid:SfDataGrid.LeftSwipeTemplate>

      <!--Right Swipe Template-->
      <sfgrid:SfDataGrid.RightSwipeTemplate>
        <DataTemplate>
          <Grid  BackgroundColor="#1AAA87">
            <Grid.ColumnDefinitions>
              <ColumnDefinition/>
              <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Label FontSize="15"
                   Grid.Column="1"
                   HorizontalTextAlignment ="Center"
                   Text ="Attend"
                   TextColor ="White"
                   VerticalTextAlignment ="Center"
                   BackgroundColor="Transparent"
                   LineBreakMode ="HeadTruncation" >
            </Label>
          </Grid>
        </DataTemplate>

      </sfgrid:SfDataGrid.RightSwipeTemplate>

    </sfgrid:SfDataGrid>

Attachment: Views_16bf672f.rar

1 Reply

VP Vimal Prabhu Manohkaran Syncfusion Team May 4, 2016 07:27 PM UTC

Hi Yim Suet Joe, 
 
Thank you for using Syncfusion Products. 
 
We were unable to reproduce the reported issue from our side. We have attached the working sample which we created based on your codes and a video reference of the sample. 
 
 
 
In case, if the issue still persists at your side, please do revert us with a modified sample to reproduce the issue with clear replication procedure. 
 
Regards, 
Vimal Prabhu

Loader.
Live Chat Icon For mobile
Up arrow icon