c# - Windows Phone 8 Longlistselector Image Cache -
i have longlistselector in xaml:
class="lang-xaml prettyprint-override"><phone:longlistselector x:name="listbox1" itemssource="{binding listview}" margin="0,140,0,0"> <phone:longlistselector.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition width="110" /> <columndefinition width="210" /> <columndefinition width="80" /> <columndefinition width="80" /> </grid.columndefinitions> <image height="110" width="110" grid.column="0" tap="image_tap" source="{binding profilepicurl}" tag="{binding username}" margin="0,1"/> <textblock grid.column="1" /> // blablabla <textblock grid.column="2" /> // blablabla <image grid.column="3"/> // blablablabla </grid> </datatemplate> </phone:longlistselector.itemtemplate> </phone:longlistselector> and listviewmodel.cs
class="lang-c# prettyprint-override">using newtonsoft.json; using system; using system.componentmodel; namespace myapp { public class listviewmodel : inotifypropertychanged { private string _userid; [jsonproperty(propertyname = "userid")] public string userid { { homecoming _userid; } set { if (value != _userid) { _userid = value; notifypropertychanged("userid"); } } } private string _profilepicurl; [jsonproperty(propertyname = "profile_picture")] public string profilepicurl { { homecoming _profilepicurl; } set { if (value != _profilepicurl) { _profilepicurl = value; notifypropertychanged("profilepicurl"); } } } private string _username; [jsonproperty(propertyname = "username")] public string username { { homecoming _username; } set { if (value != _username) { _username = value; notifypropertychanged("username"); } } } public event propertychangedeventhandler propertychanged; private void notifypropertychanged(string propertyname) { propertychangedeventhandler handler = propertychanged; if (null != handler) { handler(this, new propertychangedeventargs(propertyname)); } } } } i populate list 20 records database. , works fine don't fact app loads pics 1 time again when refresh list. because when refresh, app loads 1 time again recent 20 records net , there maybe 1 or 2 new entries on top of 20 slots list , other pictures loaded. how can "push" older ones downwards , load new records on top. don't want download old images again. how can cache it? of course of study entries on bottom disappear when newer entries come on top.
save images in isolated storage folder. load images in list folder. now, when new images needed added, save them same folder , delete not needed anymore.
this way images cached if user closes app , reopens it, saving info user too.
c# image xaml windows-phone-8 longlistselector
No comments:
Post a Comment