windows phone 8 - LongListSelector with items of variable height & content -
i've used , familiar longlistselector having specific item template items listed.
now try implement more complex longlistselector items added not of fixed height/specific content. couple of textblocks , images in 1 case , 2 times same elements in (it's set of elements appears 1,2 or 3 times per item).
note: use observablecollection connect longlistselector.
observablecollection<routeinformation> routes = new observablecollection<routeinformation>(); public routepage() { initializecomponent(); routeslonglistselector.itemssource = routes; }
and populate list pulling data database , in end adding them with
routes.add(new routeinformation(..., ...));
any suggestions?
define multiple item templates in page's resources:
<phone:phoneapplicationpage.resources> <datatemplate x:key="itemtemplate3line">... </phone:phoneapplicationpage.resources> <longlistselector x:name="lls">
and in code behind depending on condition, select custom data template:
if (...) lls.itemtemplate = resources["itemtemplate3line"] datatemplate;
Comments
Post a Comment