Reputation: 1713
I want to display items as tiles inside my app. The HubTile control is to inflexible for me, so I use this solution with a listbox. I have a few types of items and they should be displayed differently. For example, the note item has a title and a text while the image item has a image source and a name.
Implement two styles for note and image and creating the ListBoxItem dynamically with each style seems to me as an easy way, but is it the best solution?
Upvotes: 0
Views: 241
Reputation: 16092
When you have an ItemsControl that has mutliple data types in its ItemsSource and each data type has a different DataTemplate, you should use something like DataTemplateSelector.
I've written about this topic in the context of WP7/WP8 @ ListBox with multiple ItemTemplates in Windows Phone 8
Upvotes: 2