OiO.lk Blog Android Cannot click on button in CollectionView in MAUI App
Android

Cannot click on button in CollectionView in MAUI App


I can’t in any way cause a button to be pressed inside a CollectionView tag, I don’t have any errors with data binding, the problem is that the compiler doesn’t even get to the command call, what could be causing this problem?

<ScrollView Orientation="Horizontal" Margin="0,0,-300,0" Grid.Column="0" IsVisible="{Binding IsImageSelected}">
    <StackLayout>
        <CollectionView
            ItemsSource="{Binding SelectedImageList}"
            VerticalOptions="Fill"
            HorizontalOptions="Fill"
            SelectionMode="Single"
            HorizontalScrollBarVisibility="Never">
            <CollectionView.ItemsLayout>
                <LinearItemsLayout Orientation="Horizontal"/>
            </CollectionView.ItemsLayout>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Frame
                        Padding="5"
                        Margin="10,0,0,0"
                        HasShadow="True"
                        CornerRadius="8"
                        BackgroundColor="{AppThemeBinding Dark=#262626, Light=#E0E0E0}">
                        <Grid>
                            <Image
                                Source="{Binding}"
                                Aspect="AspectFill"
                                HeightRequest="50"
                                WidthRequest="50"
                                />
                            <ImageButton
                                Source="cross.svg"
                                BackgroundColor="Red"
                                WidthRequest="20"
                                HeightRequest="20"
                                HorizontalOptions="End"
                                VerticalOptions="Start"
                                Command="{Binding RemoveImageCommand}"
                                CommandParameter="{Binding}"
                                 />
                        </Grid>
                        
                    </Frame>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
    </StackLayout>
</ScrollView>

I tried to call it by pressing Grid, but that doesn’t work either, I’ve already tried a bunch of ways, I hope you can help me



You need to sign in to view this answers

Exit mobile version