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

Specify constructor for the Unity IoC container to use

c# .net unity-container ioc-container

I'm using the Unity IoC container for resolving my objects. However, I've run into an issue. When I have more than one constructor - how does Unity know which one to use? It seems to use the one with

Creating a Dataflowdiagram for a three-tiered Architecture

architecture analysis dataflow-diagram

I want to create a dataflowdiagram for a three tiered software architecture, finally I want to create a Threat Model with the Dataflow diagram.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.