windows phone 8 - Refresh an ObservableCollection when Item's property changed -


i have observablecollection loaded elements , displayed on ui .at same time app downloading 1 icon each element of observable collection.i display each icon when download finishes...

my code working guess it's not best pratice because bind collection ui control 2 times...i pretty convinced shouldn't necessary ...i try implement inotifypropertychanged on element's icon property still have add lines of code display icons:

 listdocslibs = new observablecollection<bdeskdoclib>(listboxgetdocslibs);            llslistdocslibs.itemssource = listdocslibs; 

below function dowload icons

list<bdeskdoclib> listboxgetdocslibs = new list<bdeskdoclib>();              observablecollection<bdeskdoclib> listdocslibs = new observablecollection<bdeskdoclib>();   private async void loadicondoclibs()         {             foreach (var doclib in listboxgetdocslibs)             {                      byte[] icon = await serverfunctions.getdoclibsicon(doclib);                      if (icon != null)                     {                         {                              var ms = new memorystream(icon);                              bitmapimage photo = new bitmapimage();                             photo.decodepixelheight = 64;                             photo.decodepixelwidth = 92;                             photo.setsource(ms);                             doclib.icon = photo;                         }                     }                      else if (icon == null)                     {                         doclib.icon = new bitmapimage();                         doclib.icon.urisource = new uri("/images/bdocs/ico_ext_inconnu.png", urikind.relative);                      }                 }             }              //im pretty sure following code not necessary why ui not refreshing without ?             listdocslibs = new observablecollection<bdeskdoclib>(listboxgetdocslibs);             llslistdocslibs.itemssource = listdocslibs;          } 


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -