Xamarin.forms: [Bug] CollectionView ChildAdded

Created on 25 Apr 2020  路  4Comments  路  Source: xamarin/Xamarin.Forms

Description

Event ChildAdded on CollectionView don`t fire.

Steps to Reproduce

  1. CollectionView with an ItemSource from ViewModel.
  2. Add ChildAdded Event
  3. On ChildAdded put a DisplayAlert.

Expected Behavior

Display alert on new item added on collectionview.

Actual Behavior

Do notting

Basic Information

  • Version with issue: Xamarin.Forms v4.5.0.617
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:

    • Android: 9
  • Nuget Packages: Sharpnado.Presentation.Forms 1.5.1

  • Affected Devices: All

GitHub Project

https://github.com/andrewBezerra/Xamarin_TODO

-> MyTasksView.xaml
-> MyTasksView.xaml.cs

collectionview 3 in-progress bug

Most helpful comment

This is actually huge for some users (myself included).
I used to set alternating row colors for ListViews / BindableLayouts by listening to the ChildAdded event and setting the row color based on an index.
We can't do that anymore and the alternative (templates + selector) is only feasable for "smaller layout" but in my case i got a grid per row with 6 different columns and some GestureRecognizers and in a SwipeView - having this massive piece of XAML twice in one page is just not readable at all.

All 4 comments

I noticed this too while working with the latest nightly builds. This would be a great bug fix to have.
In case it helps anyone, as a workaround, for now, I just listened for changes in the ItemsSource.

You will need to listen to the property changed of the CarouselView, cast ItemsSource to INotifyCollectionChanged and then subscribe to the CollectionChanged event.

This is actually huge for some users (myself included).
I used to set alternating row colors for ListViews / BindableLayouts by listening to the ChildAdded event and setting the row color based on an index.
We can't do that anymore and the alternative (templates + selector) is only feasable for "smaller layout" but in my case i got a grid per row with 6 different columns and some GestureRecognizers and in a SwipeView - having this massive piece of XAML twice in one page is just not readable at all.

Hi,
Any progress of this issue? I am using 4.7.0.1080 and it's still exist.
Thank you.

@Denn1Ro this here is the link to the corresponding PR https://github.com/xamarin/Xamarin.Forms/pull/10812
To me it looks like there is some good progress happening. I'm waiting aswell...

Was this page helpful?
0 / 5 - 0 ratings