I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the moment I can only use the ItemTemplate setting to define one template for them all. Any way to achieve this?
Share
the
ItemTemplateSelectorwill work but I think it is easier to create multipleDataTemplates in your resource section and then just giving each one aDataType. This will automatically then use thisDataTemplateif the items generator detects the matching data type?Also make sure that you have no
x:Keyset for theDataTemplate.Read more about this approach here