c# - XAML templating data -


i have listview populated 3 different types of items. when select listviewitem in listview want display data in template designed type of selected item.

the data displayed in different column in same grid listview.

my question is, element should use make new templates displaying data selected item.

i hoping possible set sort of itemtemplate property on grid, not case.

<grid     x:name="itemdetailsgrid"     datacontext="{binding selecteditem}"     itemtemplate="{staticresource {binding selecteditem.templatename}}">          </grid> 

what correct way of doing this?

i think going need contentpresenter

<contentpresenter    x:name = "itemdetailsgrid"    content = "{binding selecteditem}">    <contentpresenter.resources>       <datatemplate datetype="{x:type type1}">           <textblock text="{binding propertya}" />       </datatemplate>       <datatemplate datetype="{x:type type2}">           <textblock text="{binding propertyb}" />       </datatemplate> </contentpresenter> 

the appropriate template chosen based on it's type.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -