Select to view content in your preferred language

TapGesture on image in a datagrid

849
0
10-05-2017 01:01 AM
NadirHussain
Frequent Contributor

when i put my code like below it works

<Image Source="password.png">
<Image.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding TapCommand}"
CommandParameter="Image1" />
</Image.GestureRecognizers>
</Image>

but when i place the image inside  a datagrid cell

  

   

<StackLayout Padding="20" Spacing="10" BackgroundColor="Green">
<dg:DataGrid ItemsSource="{Binding Test}" SelectionEnabled="True" SelectedItem="{Binding SelectedSiren}" RowHeight="30" HeaderHeight="50" BorderColor="#CCCCCC" HeaderBackground="#E0E6F8" ActiveRowColor="#8899AA"
PullToRefreshCommand="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}" >

<dg:DataGrid.Columns>
<dg:DataGridColumn Title="Logo" PropertyName="Logo" Width="100" SortingEnabled="False">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding}" HorizontalOptions="Center" VerticalOptions="Center" Aspect="AspectFit" HeightRequest="60">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapCommand}" CommandParameter="Logo" NumberOfTapsRequired="3">

</TapGestureRecognizer>
</Image.GestureRecognizers>
</Image>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="NAMe" PropertyName= "Name" Width="2*">

</dg:DataGridColumn>

</dg:DataGrid.Columns>

<dg:DataGrid.RowsBackgroundColorPalette>
<dg:PaletteCollection>
<Color>#FFF2F2</Color>
<Color>#FFFFFF</Color>
</dg:PaletteCollection>
</dg:DataGrid.RowsBackgroundColorPalette>

</dg:DataGrid>
</StackLayout>

but when i place the image inside a datagrid cell template tapgesture not work.please help to solve this issue

thanks in advance

Tags (1)
0 Kudos
0 Replies