.NET MAUI TapGesture Command not working in CollectionView

71 views Asked by At

I have a CollectionView desing:

<CollectionView ItemsSource="{Binding Days}" SelectedItem="{Binding SelectedDay}">
    <CollectionView.ItemsLayout>
        <GridItemsLayout 
               Orientation="Vertical"
                VerticalItemSpacing="5"
                Span="7" />
    </CollectionView.ItemsLayout>
    <CollectionView.ItemTemplate>
        <DataTemplate x:DataType="viewModels:CalendarEntries">
            <Grid>
                <Label 
                    Text="{Binding Day}" Padding="0"
                    TextColor="{StaticResource Primary}"
                    HorizontalTextAlignment="Center"
                    VerticalTextAlignment="Center"
                    FontSize="17"
                    FontFamily="MagistralC"/>
                <customControls:CircularProgressBar
                   Progress="{Binding Progress}"
                   ProgressColor="{StaticResource Primary}"
                   ProgressLeftColor="LightGray"
                   Size="40"
                   TextColor="{StaticResource Primary}"
                   Thickness="4">
                    <customControls:CircularProgressBar.Triggers>
                        <DataTrigger
                            TargetType="customControls:CircularProgressBar"
                            Binding="{Binding Progress}"
                            Value="0">
                            <Setter 
                                 Property="IsVisible" Value="false"/>
                        </DataTrigger>
                    </customControls:CircularProgressBar.Triggers>
                </customControls:CircularProgressBar>
                <Grid.GestureRecognizers>
                    <TapGestureRecognizer 
                        Command="{Binding ShowProgressDetailsCommand , Source={RelativeSource AncestorType={x:Type viewModels:StatisticsViewModel}}}"
                        CommandParameter="{Binding .}">
                        
                    </TapGestureRecognizer>
                </Grid.GestureRecognizers>
            </Grid>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

In the viewModel there is a command and I'm following the MVVM pattern and used commands and command properties in other views( but not in a collectionView with TapGesture). Is there a problem with CollectionView?

Update : When I press on specific pixel outside the label and circle progress bar It actually hits command breakpoint in the viewModel. What can be the problem?

0

There are 0 answers