无法在ControlTemplate中引用控件

时间:2010-12-15 10:56:17

标签: c# wpf controls controltemplate

我有一个ResourceDictionary,它包含一个ControlTemplate,我从另一个程序集中引用对象。

<ResourceDictionary
    xmlns:gauge="clr-namespace:ActiproSoftware.Products.Gauge;assembly=ActiproSoftware.Gauge.Wpf351">

    <ControlTemplate x:Key="Gauge270Template">
        <gauge:CircularGauge/>
    </ControlTemplate>
</ResourceDictionary>

这给了我以下错误:

Error   1   The type 'gauge:CircularGauge' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

P.S。仪表组件已构建,我可以从应用程序的其他部分引用它

1 个答案:

答案 0 :(得分:1)

确保两个程序集都不以Project Properties的Build部分中的Client Profile为目标。可能将引用Gauge控件的程序集设置为.Net Framework 4.0 Client Profile(默认来自VS 2010)(您还可以在构建错误的警告部分中看到此问题)