xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

ViewCell.ContextAction interferes with ListView.ItemSelected event #2498

Closed kirillkostrov closed 6 years ago

kirillkostrov commented 6 years ago

Description

On Android if ListViewCell have ContextActions ListView.ItemSelected is not fired. Affects only Android app. If I comment ContextActions it starts to work again. Same problem was reported fixed in this Bug: https://bugzilla.xamarin.com/show_bug.cgi?id=58833 Reported fixed in 2.4.1 but reappeared in 2.5.1

Steps to Reproduce

Add any ContextActions to ListView ViewCell

Expected Behavior

ItemSelected should fire

Actual Behavior

ItemSelected not fired

Basic Information

Reproduction Link

Repro project from this issue should display that problem still exists https://bugzilla.xamarin.com/show_bug.cgi?id=58833

hardikphd commented 6 years ago

Here is the stack track of the issue System.NullReferenceException: Object reference not set to an instance of an object. BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) D:\agent\_work\1\s\Xamarin.Forms.Core\BindableObject.cs:106 Cell.OnContextActionsChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) D:\agent\_work\1\s\Xamarin.Forms.Core\Cells\Cell.cs:178 ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) ObservableCollection1[T].InsertItem (System.Int32 index, T item) Collection1[T].Add (T item) SearchTagKnownPage+<InitializeComponent>_anonXamlCDataTemplate_0.LoadDataTemplate () ElementTemplate.CreateContent () D:\agent\_work\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82

samhouts commented 6 years ago

I wasn't able to reproduce it with the project from 58833 with 2.5.1. Can you try the attached project and see if you can alter it such that it demonstrates the issue? Thanks!

Issue2498.zip

PureWeen commented 6 years ago

https://github.com/xamarin/Xamarin.Forms/issues/1932

pauldipietro commented 6 years ago

Closing as we've had no further responses for roughly a month. Please reopen with more information and a reproduction if the issue still occurs on 3.0/3.1-pre.

acaliaro commented 6 years ago

I have tried today. I have the same problem with 3.1.0.469394 on a Datalogic DLAXISTS with android 4.4.4