I would like to bind a content control to a data template selector, bind a variable to that content control and then display a different template depending on what the variable contains.
I've managed to get a Telerik DataTemplateSelector to do what I need it to, however I can't find a control to bind the DataTemplateSelector to.
All of the controls that I've found that allow me to use a DataTemplateSelector require the ItemsSource to be a collection, if I pass in a single object it throws an exception.
The item I'm passing in is a single item not a collection. The content control seems to be what I need but i can't bind a DataTemplateSelector to it.
Is there a telerik control similar to the Content Control, that I can bind a DataTemplateSelector to? Or is there something similar to a DataTemplateSelector that I can bind to a Content Control.
Any help would be greatly appreciated.
I think you should consider avoiding Telerik's classes (which, in my opinion, complicate the things a bit in this case).
What about a standard
DataTemplateSelectorimplementation? It's very easy to implement by yourself!First you declare a "classic" implementation of the abstract class
DataTemplateSelector:Then you can write you custom
DataTemplateSelector......and finally the XAML designing (not the usual ListBoxItem, but a scrollable content in this case):