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

ListView tap selects wrong item (or returns wrong data)

$
0
0

Hello.

I am having a listView (with grouping but the error also appears without grouping but not that often) like this:

<StackLayout>
    <Image Source="header.png" />
    <ListView x:Name="listView" ItemsSource="{Binding ItemsGrouped}"
                  IsGroupingEnabled="True"
                  GroupDisplayBinding="{Binding Key}"
                  GroupShortNameBinding="{Binding Key}"
                  RowHeight="{StaticResource rowHeight}">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <StackLayout Orientation="Horizontal">
                            <Image WidthRequest="{StaticResource boxSize}"
                                         HeightRequest="{StaticResource boxSize}"
                                         Source="{Binding Image}" />

                            <StackLayout Padding="5, 0, 0, 0" VerticalOptions="Center">
                                <Label Text="{Binding Name}" Font="Bold, Medium" />
                            </StackLayout>
                        </StackLayout>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</StackLayout>

With the image "header.png" wrong entries get selected - without the image everything works fine. That is a really strange behavior! An image above a list should not change the item which gets selected. Anyone knows why this is? And how to fix this? I am currently using Forms 1.2.3.6257 on a windows phone device.

I've attached a demo project. (Try to select "Item" in the list. "G-Item0" will get selected and NOT "Item")

Cheers and thanks,

Tim.


Viewing all articles
Browse latest Browse all 58056

Trending Articles