我有一个 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.
附言仪表组件已构建,我可以从应用程序的其他部分引用它
最佳答案
确保两个程序集都不以项目属性的构建部分中的客户端配置文件为目标。可能引用 Gauge 控件的程序集设置为目标 .Net Framework 4.0 Client Profile(VS 2010 的默认设置)(您还可以在构建错误的警告部分看到此问题)
关于c# - 无法在 ControlTemplate 中引用控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4449132/