Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] Long Press blocks CollectionView selection  #760

@davidortinau

Description

@davidortinau

Description

When I add TouchEffect to any element inside my CollectionView ItemTemplate I lose the selection from CollectionView itself.

My goal is to have a long press on the item, and still allow multiple selection. See the video:

https://www.screencast.com/t/TMYYOopoTFQ

<CollectionView Margin="8"
            x:Name="PhotosCV"
            SelectionMode="Multiple"
            SelectedItems="{Binding SelectedPhotos, Mode=TwoWay}"
            SelectionChangedCommand="{Binding SelectionChangedCommand}"
            ItemsSource="{Binding Photos}"
            >
    <CollectionView.ItemsLayout>
        <GridItemsLayout
        Orientation="Vertical"
        Span="2"
        HorizontalItemSpacing="8"
        VerticalItemSpacing="8"/>
    </CollectionView.ItemsLayout>
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <Frame
            HeightRequest="120"
            CornerRadius="0"
            Padding="0"
            BackgroundColor="{StaticResource ThemePrimary}"
            Visual="Material"
            HasShadow="True"
            
            >
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal">
                            <VisualState.Setters>
                                <Setter
                                Property="Padding"
                                Value="0"/>
                                <Setter
                                TargetName="CheckIcon"
                                Property="Image.IsVisible"
                                Value="False"/>
                            </VisualState.Setters>
                        </VisualState>
                        <VisualState x:Name="Selected">
                            <VisualState.Setters>
                                <Setter
                                Property="Padding"
                                Value="8"/>
                                <Setter
                                TargetName="CheckIcon"
                                Property="Image.IsVisible"
                                Value="True"/>
                            </VisualState.Setters>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Grid
                    xct:TouchEffect.HoveredScale="1.2"
                    xct:TouchEffect.NativeAnimation="True"
                    xct:TouchEffect.LongPressDuration="200"
                    xct:TouchEffect.LongPressCommand="{Binding LongPressCommand, 
                    Source={RelativeSource AncestorType={x:Type pg:PhotoGalleryViewModel}}}"
                    >
                    <Image
                    Source="{Binding ImageSrc}"
                    Aspect="AspectFill"/>
                    <Image
                    x:Name="CheckIcon"
                    Source="{FontImage FontFamily=FontAwesome,
                        Glyph={x:Static app:IconFont.CheckSquare},
                        Color={StaticResource ThemePrimary},
                        Size=18}"
                    VerticalOptions="End"
                    HorizontalOptions="Start"
                    Margin="4"/>
                </Grid>
                
            </Frame>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

Basic Information

  • Version with issue: 1.0.0

    • Android: 10
  • XF 5

Reproduction Link

https://github.com/davidortinau/Xappy/tree/feature/longpress

Metadata

Metadata

Labels

a/TouchEffectbugSomething isn't working. Breaky break.p/androidThis issue impacts Androids/unverifiedThis issue needs verification/reproduction by a team member. PRs cannot be accepted/merged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions