question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ListView ItemSelected not called

See original GitHub issue

On iOS everything works great but on Android the “ItemSelected” of the ListView is not triggered anyway. The Context-Action work perfectly, but when I click on the Content, nothing happens. Do I do something wrong or is this a bug?

<ListView x:Name="SampleList" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" RefreshCommand="{Binding LoadItemsCommand}" IsPullToRefreshEnabled="true" IsRefreshing="{Binding IsBusy, Mode=OneWay}" CachingStrategy="RecycleElement" ItemSelected="OnItemSelectedAsync" Margin="0, 0, 0, 10">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <contextmenu:SideActionBarCell>
                            <contextmenu:SideActionBarCell.Content>
                                    <ContentView WidthRequest="{Binding Source={x:Reference SampleList}, Path=Width}">
                                        <StackLayout Orientation="Horizontal" Padding="10, 0, 5, 0" HorizontalOptions="FillAndExpand">
                                            <StackLayout Orientation="Vertical" Margin="10, 0, 0, 0" HorizontalOptions="FillAndExpand" VerticalOptions="Center">
                                                <Label Text="{Binding Name}" LineBreakMode="WordWrap" FontSize="15" TextColor="{StaticResource Primary}" FontAttributes="Bold" />
                                                <Label Text="{Binding Herkunft}" LineBreakMode="WordWrap" FontSize="13" TextColor="{StaticResource LightTextColor}" />
                                            </StackLayout>
                                            <Image Source="ic_arrow_right.png" VerticalOptions="Center"/>
                                        </StackLayout>
                                    </ContentView>
                            </contextmenu:SideActionBarCell.Content>
                            <contextmenu:SideActionBarCell.ContextTemplate>
                                <DataTemplate>
                                    <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="{StaticResource Primary}">
                                        <ImageButton HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Source="ic_list_more.png" Clicked="OnMore" Margin="15, 0, 15, 0"  BackgroundColor="{StaticResource Primary}"/>
                                    </StackLayout>
                                </DataTemplate>
                            </contextmenu:SideActionBarCell.ContextTemplate>
                        </contextmenu:SideActionBarCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CodeOfDarknesscommented, Apr 23, 2019

Please forget about my last comment. Now it works.

Very much thanks to you for helping me 😃

0reactions
AndreiMisiukevichcommented, Apr 23, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

ListView's ItemSelected event is not firing when list item is ...
In my real requirement I'm using a grouped ListView where most of the groups don't need swipe actions. When list items count getting...
Read more >
ItemSelected/ItemTapped is not called in listview if an item ...
ItemSelected (and ItemTapped) is not called on a listview, if it has label with TapGestureRecognizer: <ListView.ItemTemplate> <DataTemplate>
Read more >
ListView Item Selected/Tapped not Working on iOS
We have recently implemented ItemSelected on one of our ListView components. It works fine on Android, but on iOS the list items only ......
Read more >
[Code]-MultiSelectable ListView - ItemSelected is not called
When the ListView.SelectedItem changes, the the ItemSelected event will be triggered. But when using IEnumerable object returned from Linq the SelectedItem ...
Read more >
iOS ListView item selected event is not firing. Xamarin ...
Listview item selected event is not fired on iOS if ListView container has TapGestureRecognizer bound to it. Reproduction steps:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found