Brian Noyes shows you how to use the DataTemplateSelector class in Prism 4.
Source: Brian Noyes' Blog
DataTemplates in WPF have a very important feature: the DataType property that allows DataTemplates to be automatically applied to a data bound object based on its type. This feature is very similar to the implicit styles capability that WPF has had since the start that is a new feature in Silverlight 4.
Unfortunately Silverlight is still lacking this feature. In Silverlight, you have to associated a single data template with a data bound control through its template property (ItemTemplate for ItemsControl and ContentTemplate for ContentControl). When you want to bind to a heterogeneous collection of objects (that all share a common base class or interface that the collection is defined in terms of), you are kind of stuck in Silverlight if you want to write specific templates per derived type.