开发者

ContentTemplate selection based upon the DataContext in Silverlight 4

开发者 https://www.devze.com 2023-01-06 02:15 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消