Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Update ListView after editing an item

NikosGNikosG DEMember ✭✭

Hello guys,

I tried to figure out how could I update my ListView after editing an already existed item. I found the following solutions:


More than less they are using the same tactic with a different way.

My questions is: do I need always to repopulate the listview after a change or after adding a new item?

Thanks in advance :)

Best Answer


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭
    edited December 2016

    Disclaimer: I only took a 60 second glance to confirm a suspicion.

    It looks like you are honoring INotificationPropertyChanged - but not INotifyCollectionChanged.

    So when you assign a complete new collection to the collection property, that raises an event.
    But if an element WITHIN the collection changes there is no event, and thus your UI does not update automatically.

    If you handle the CollectionChanged event as well, then your UI would hear the element within the collection change and update automatically: You would't have to reload programmatically.

    My base levels usually look like this so code can be aware of all the really common needs:

        public class ModelBase : INotifyPropertyChanging,
  • NikosGNikosG DEMember ✭✭
    edited December 2016

    @ClintStLaurent thank you very much. Actually that was what I really forgot to implement. But what if the user decide after all these changes just to cancel and rollback?

    I mean could you please help me further as long as I am new with Xamarin.

    And I just take a look... The INotifyCollectionChanged is only if a new item will be added or an old will be removed. What happens onEdit of an existed item?

Sign In or Register to comment.