简体   繁体   中英

Can't reference a control inside ControlTemplate

I have a ResourceDictionary which contains a ControlTemplate where I reference object from another assembly.

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

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

Which gives me the following error:

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.

PS gauge assembly is built and I am able to reference it from other parts of the application

Make sure both assemblies do not target the Client Profile in the Build section of Project Properties. Probably the assembly that has the reference to the Gauge control is set to target .Net Framework 4.0 Client Profile (default from VS 2010) (You can also see this problem in the Warnings section of your build-errors)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM