Tuesday, 15 May 2012

.net - Metro App Access DataTemplate Control -



.net - Metro App Access DataTemplate Control -

i have listbox command next layout, has custom command in it:

<listbox x:name="testlist" itemssource="{binding}" borderbrush="{x:null}" borderthickness="0" margin="0" padding="0"> <listbox.itemtemplate> <datatemplate> <controls:myusercontrol x:name="testlistitem"/> </datatemplate> </listbox.itemtemplate> </listbox>

i trying access myusercontrol codebehind so:

testlist.itemcontainergenerator.containerfromitem(testlist.selecteditem);

unfortunately, returns null. i've read somewhere setting virtualizingstackpanel.isvirtualized="false" on listbox in xaml fixes this.

but property not available in metro. know of way on how achieved?

resolved followed approach:

reference datatemplate solution

works well. enjoy!

.net xaml listbox microsoft-metro datatemplate

No comments:

Post a Comment