在我的主/详细方案中,我有一个datagrid作为master,一个UserControl作为child。 当在主网格中选择特定行时,我将其分配给UserControl的DataContext。 在我的用户控件中,我有几个DataTemplates作为Resources和ContentControl作为子容器。我正在努力的是如何根据UserControl的DataContext的属性TemplateName动态选择ContentControl的ContentTemplate。
<ContentControl ContentTemplate="{Binding Source={StaticResource ????}}" Content="{Binding}"/>