Listview not updating after PopAsync

JesperChristensenJesperChristensen USMember
edited November 2015 in Xamarin.Forms


I got a listview in my MainPage, where i can select each individual item. When i do i do a pushSync and go to some page where i can select some items. When i select them i send out a message using the messagingCenter. I send one to my viewmodel so that it can clear all other selected items so i only ever have 1 select.. that works fine.
I also send a message to the viewmodel in the page BEFORE my select page..(MainPage) In debug i can see that this page also receives a message.
Then i can push a back button that will do a PopAsync and send me to the MainPage.
The implementation of the message on the MainPage looks like this:

MessagingCenter.Subscribe<PurposePage, string>(this, "Selected", (sender, arg) =>
driveReport[0].Description = arg;
DriveReport = driveReport;

driveReport is a private ObserverableCollection containing a template item. I wanna set 1 of the fields and then notify my view.

public const string DriveProperty = "DriveReport";
public ObservableCollection DriveReport
get { return driveReport; }
driveReport = value;

    protected void OnPropertyChanged(string propertyName)
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

What am i doing wrong since the listview isnt updating when i return? Now im aware that the MainViewModel is actually called when its not on the top of the navigation stack.. does that matter?

Hope i explained it well enough for you guys to understand :) im new to xamarin.

EDIT: why are my code fields looking like trash? >.<


Sign In or Register to comment.