ValueConveter or DataTemplate

I am trying to build a generic interface that can accept a List of objects and then based on the users selection of how they want to view the objects will select different ways of display the object. Currently, the user has a dropdown that allows them to choose the view type such as "Details, Previews, etc" much like explorer and then based off the selection the display should change. My first attempt at this was to create UserControls that will accept the bound object and display it, however I dont know how to convert my listitems into the user controls. My question is, is should I be using IValueConverter to convert the listitem into the type of user control I want to display, or should I be using DataTemplates and a TemplateSelector to define my different views?

Answers


Why not just use ListView and GridView? Your use case is exactly why they're there.

MSDN has a nice little sample for how to switch views in a ListView at runtime right here.


Need Your Help

How to create a 2D grid in webpage?

javascript html webpage

How can I create a grid (10X10) in a webpage and allow an user to click any position in the grid and recording the (x,y) position in one-decimal approx such as covering the values 0.0~10.0 or 0.1~9...

Having trouble getting anything back but what the default constructor is giving

c# class methods constructor

I feel like I am getting close using the debugger but am still not able to figure this one out.