Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to get item click on collectionview in xamarin forms with prism framwork?

$
0
0

I have created a list and showing in collectionview


<CollectionView.ItemsLayout>

</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>

                        <StackLayout HorizontalOptions="FillAndExpand" Padding="16,0">
                            <Frame x:Name="frame" HasShadow="False" Padding="8"

                                   HeightRequest="64" CornerRadius="10" BackgroundColor="{DynamicResource ColorInteraction1Lightest}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="2*" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30" />
                                        <ColumnDefinition Width="2" />
                                        <ColumnDefinition Width="64" />
                                        <ColumnDefinition Width="24" />

                                    </Grid.ColumnDefinitions>
                                    <Label Text="{Binding LeaveSummaryTitle}" HorizontalTextAlignment="Start" FontSize="{DynamicResource FontSize3}" TextColor="{DynamicResource ColorInteraction1Base}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" />
                                    <Label Text="{Binding LeaveCount}" HorizontalTextAlignment="Start" FontSize="{DynamicResource FontSize10}" TextColor="{DynamicResource ColorInkBase}" Grid.Row="1" Grid.Column="0" />
                                    <BoxView Grid.Row="1" Grid.Column="1" BackgroundColor="{DynamicResource ColorInkBase}" />
                                    <Label Text="{Binding LeaveDate}" HorizontalTextAlignment="Start" FontSize="{DynamicResource FontSize3}" TextColor="{DynamicResource ColorInkBase}" Grid.Row="1" Grid.Column="2" />
                                    <Image x:Name="image" Margin="0,4" Aspect="AspectFit" HeightRequest="24" WidthRequest="24" Source="icon_info" Grid.Row="1" Grid.Column="3" effects:TooltipEffect.Position="Top" effects:TooltipEffect.BackgroundColor="Navy" effects:TooltipEffect.Text="{Binding ToolTipText}" effects:TooltipEffect.HasTooltip="True" >



                                        </Image>




                                </Grid>


                                <Frame.GestureRecognizers>
                                 <TapGestureRecognizer Command="{Binding InfoCommand}" CommandParameter="{x:Reference image}"/>
                                 </Frame.GestureRecognizers>
                            </Frame>
                        </StackLayout>

                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>


           Viewmodle =>

public DelegateCommand InfoCommand { get; set; }
InfoCommand = new DelegateCommand(ShowInfo);

private void ShowInfo(Picker picker)
{

    }

Whenever I click on the item of the collectionview nothing happening. As per my code it should call ShowInfo method.

Please help


Viewing all articles
Browse latest Browse all 91519

Trending Articles