WPF ItemTemplateSelector to single item

datatemplate, itemtemplateselector, wpf

Solution

Seems that what you are looking for is the ContentTemplateSelector of a ContentControl.

Problem

ItemTemplateSelector is applied to collections of objects - ItemsControl for example. Is there the same functionality for single items controls? I want to choose a data template taking in consideration a value inside an object. I can do this for lists but not single items. edit: In another screen I have this implementation: ``` <ItemsControl ItemsSource="{Binding Path...} ItemTemplateSelector={...} ``` The thing is, now I only have one item and still want to have a itemtemplateselector ... edit 2: The question that arises can also be: How can I put just one item in the ItemsSource?

Original source