c# - Androids' BaseAdapter equivalent in Windows Store apps -
i have large array of integer items want display in listview formatting. on android extend baseadapter (this example of dynamic view/control creation):
public view getview(int position, view convertview, viewgroup parent) { if(convertview!=null){ //inflate convertview if doesn't exist } myview v = (myview)convertview; v.setid(position); v.setnumber(myintegerarray[position]); return v; } i know how in c# windows store app. not find meaningful information on topic.
i not want create list (or other itemssource object) everytime, beacuse take memory , slow (i have refresh array values).
xaml-based ui technologies have capability called ui virtualization reduces memory consumption , processing time when dealing large collections of data presented in items-based uis (itemscontrols).
in order allow this, while keeping capability update ui whenever items added/removed/changed in underlying data collection, need databind ui observablecollection<t>:
<listbox itemssource="{binding}"/> code behind:
var numbers = enumerable.range(0,100); datacontext = new observablecollection<int>(numbers); keep in mind declarative, databinding-based approach in xaml based ui technologies different procedural approach in other frameworks. in xaml, never need create ui elements in procedural code, define them in xaml , databind ui relevant collection of data items, , ui framework takes care of rest.
Comments
Post a Comment