C# ContentControl无法绑定到DataTemplate

C# ContentControl无法绑定到DataTemplate,c#,wpf,xaml,mvvm,C#,Wpf,Xaml,Mvvm,在名为Type的POCO类上绑定自定义属性时,我无法将绑定到本地资源(我希望这不是因为命名选择不当) ReportItemModel public class ReportItemModel { public ReportItemModel(string name, ReportItemType itemType, Type type) { Name = name; ItemType = itemType;

在名为
Type
的POCO类上绑定自定义属性时,我无法将
绑定到本地资源
(我希望这不是因为命名选择不当)

ReportItemModel

public class ReportItemModel
{
        public ReportItemModel(string name, ReportItemType itemType, Type type)
        {
            Name = name;
            ItemType = itemType;
            Type = type;
        }

        public string Name { get; }
        public ReportItemType ItemType  { get; }
        public Type Type { get; }
}
XAML

<ContentControl Content="{Binding Type}"  Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">

      <ContentControl.Resources>
            <DataTemplate DataType="{x:Type moduleTypes:ReportModule}">
                   <Label>Test</Label>
             </DataTemplate>
      </ContentControl.Resources>

</ContentControl>

试验

Type
属性是(正如您可能猜到的)一个
系统。Type
并且我的WPF应用程序中的输出总是
ToString()
的输出,我猜这是因为我的
匹配失败。如果我将
ContentControl
更改为
Content={Binding}
,并将
设置为接受POCO类的数据类型
ReportItemModel
,它将按预期工作。我能看到的唯一区别是,
ReportItemModel
已经实例化,而
类型
属性没有实例化

问题在于XAML
DataType=“{x:Type moduleTypes:ReportModule}”
System.Type
上幕后调用
GetType()
,它总是返回一个,因为对象从未实例化过,而且总是(此时)一个
System.Type
(至少可以说是一个“大脑放屁”的时刻)。通过在绑定