c# - Update Binding in Windows Phone Runtime app -
i'm trying modify items listview on windows phone runtime app.
the items binded listview simple binding:
this.defaultviewmodel["mybinding"] = pi; and in xaml:
<listview itemssource="{binding mybinding}" ... > then, i'm modifying binding code:
list<myitem> pi = (list<myitem>)this.defaultviewmodel["mybinding"]; pi.removeat(5); now, want update ui new modified pi. know this.defaultviewmodel["mybinding"] = null; , this.defaultviewmodel["mybinding"] = pi; works, doesn't keep scroll position of listview (it jumps top after doing this).
also have tried this answer, seems updatetarget not available in windows phone runtime apps.
so, should force refresh itemssource of listview, without losing it's scroll position?
you should using observablecollection<myitem> instead of list<myitem>. won't need unset , set list update listview.
to scroll item in listview listview listview, can call listview.scrollintoview(item).
Comments
Post a Comment