Listview not updating after PopAsync

JesperChristensenJesperChristensen USMember
edited November 2015 in Xamarin.Forms

Hi.

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:

<br /> MessagingCenter.Subscribe&lt;PurposePage, string>(this, "Selected", (sender, arg) =><br /> {<br /> driveReport[0].Description = arg;<br /> DriveReport = driveReport;<br /> });<br />

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

<br /> public const string DriveProperty = "DriveReport";<br /> public ObservableCollection<DriveReportCellModel> DriveReport<br /> {<br /> get { return driveReport; }<br /> set<br /> {<br /> driveReport = value;<br /> OnPropertyChanged(DriveProperty);<br /> }<br /> }</p> <pre><code> 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? >.<

Answers

Sign In or Register to comment.