Question

I have windows phone 8 app which displays a persons pic and his details sent from server (something similar to a contact book).

The way I have implemented this, is by storing images from server in Isolated Storage with a unique name, and then adding this unique name and person's information in database.

I implemented the GUI, by binding the database to a LongListSelector (using Observable Collection). LongListSelector's item template has an Image control and I use ValueConverter class to translate the unique name from database to the physical location of the image. When server sends an update to personal information, I can simply update the database and data binding will update the UI automatically. Until here everything works perfectly.

Now I have this scenario : When the server sends an updated image, I can only update the isolated storage. How can I let the GUI know that image is updated? I am not sure how to make use of databinding here, since the image name doesn't change and there is no update process in database table.

Is there a way other than reloading the entire collection?

Was it helpful?

Solution

I guess that the class bound with the UI is acting like a ViewModel and is implementing the INotifyPropertyChanged interface or some derived class (ViewModelBase for example if you're using MVVM Light).

In that case, you should raise the ProperChanged event (or call the RaisePropertyChanged method in MVVM Light) with the name of the property bound with the image control in order to notify the UI that the data has changed. The converter will be called again and the image will update.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top