ItemTapped / ItemSelected does not start on ListView - Xamarin.Forms

I am working on a ListView that has two labels and a horizontal list (with a TapGestureRecognizer applied to the horizontal list only) in its cell view.

I have implemented ItemTapped / ItemSelected to get the index value for the selected ListView item and test it with breakpoints.

The problem is that events do not fire when I click / select in the Horizontal list box, they only fire when I click / select a space other than the Horizontal list box.

Code for ItemTapped

                    int lvIndex;
                    timePlannerLV.ItemTapped += (sender, e) =>
                    {
                        lvIndex = itemLV.IndexOf(e.Item as LVItem);            
                    };

      

Code for ItemSelected

                    int lvIndex;
                    timePlannerLV.ItemSelected += (sender, e) =>
                    {
                        lvIndex = itemLV.IndexOf(e.SelectedItem as LVItem);        
                    };

      

I want the event to fire when clicked anywhere in the ListView.

Any help would be greatly appreciated. Thanks in advance.

+3


source to share





All Articles