[Version 2.0] Creating UserControls per data template

Apr 2, 2012 at 11:55 AM

I'm using the Prism library, and would very much like to store my views as separate UserControls, which also means that my XAML doesn't have to be quite so lengthy. I realise I can embed a UserControl in the datatemplate into the <DocumentTemplateSelector.MyFirstView><DataTemplate><my:UserControl />, however as I'm importing the views and viewmodels using MEF exports, I would like this to be a slightly more dynamic process, which is possible if (for example) I can return a UserControl as a DataTemplate (from the DataTemplateSelector class). Is it possible to get UserControl content to populate the anchorable or document panes?

Thanks.