ContentTemplate selection based upon the DataContext in Silverlight 4
In my Master/detail scenario, I have a datagrid as master and a UserControl as child. When a particular Row being selected in master grid I assign it to the UserControl's DataContext. In my User Control I ha开发者_开发知识库ve couple of DataTemplates as Resources and ContentControl as the Child Container. What I'm struggling with is how to dynamically select the ContentTemplate of ContentControl based upon the UserControl's DataContext's property TemplateName.
<ContentControl ContentTemplate="{Binding Source={StaticResource ????}}" Content="{Binding}"/>
For SL here is the link on Silverlight DataTemplateSelector which should be useful to resolve the problem.
精彩评论