Xamarin.forms: Xamarin CollectionView does not display inserted row on iOS from MessagingCenter message

Created on 24 Apr 2020  ·  3Comments  ·  Source: xamarin/Xamarin.Forms

_This issue has been moved from a ticket on Developer Community._


CollectionView is bound to an ObservableCollection and an Item is added to the collection, upon receipt of a MessagingCenter message, the CollectionView does not display the changed collection. On Android the Item will appear in the bound CollectionView, issue is only on iOS.

If you add a record and delete a record the new Item does appear. Seems CollectionView does not display the last record when the CollectionChanged event fires on the insert from a Message.

To replicate the issue create a new Xamarin.Forms Shell app and set the iOS project as the startup project. Run the app. It will show the six items by default. Click add to go to the New Item screen and click save there. The new item does not appear in the CollectionView. If you pull to refresh the item will appear.

The issue seems to appear when the item is being added from a MessagingCenter subscriptions. If you modify ItemsPage.xaml.cs by doing a viewModel.Items.Add in the AddItem_Clicked handler, the Item will display as expected. If you were to subscribe to the “New Item” message on that file, when the message arrives and the Item is added, it does not update the display.


Original Comments

Visual Studio Feedback System on 4/20/2020, 00:54 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

collectionview iOS 🍎 unverified bug

All 3 comments

I am having similar issues. In fact, running the default Visual Studio Shell Project outlines this issue clearly when an "Item" is added/saved. It does not show up in the ItemsPage CollectionView until it is refreshed.

I am having similar issues. In fact, running the default Visual Studio Shell Project outlines this issue clearly when an "Item" is added/saved. It does not show up in the ItemsPage CollectionView until it is refreshed.

Are you encountering the issue only when updating the collection via a MessageCenter message? I submitted the initial bug on Visual Studio and they moved it here. I didn't attach any code as I mentioned that the Shell default shows the error. I noted in the issue that directly adding an item to the collection updates correctly, it just does not update when the collection is modified by a MessageCenter message and wanted to see if that is what you are seeing also.

This was fixed in 4.6.

Was this page helpful?
0 / 5 - 0 ratings