I'm trying to create and use a WPF Custom Control within a WPF Window. The Window is defined in a Class Library Project and used in an Office Word AddIn Project, while the Custom Control is defined in a Wpf Custom Control Library Project.
There aren't any errors before the project is started, the corresponding classes are also suggested by code completion.
The actual problem occurs in the Constructor of the Wpf Window, where the InitializeComponent() method throws an Exception with the following information:
"A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: Could not load file or assembly 'WpfCustomControlLibrary, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
This behaviour occurs regardless of the content of the mentioned classes, I have tried this with the most basic code possible. I also tried to create the Wpf Window right in the AddIn Project, using just the Wpf Custom Control Library Project (no separate Class Library). Although this scenario works just fine, I would very much appreciate to keep the separate Class Library for structural purposes.
Any help is highly appreciated, if further information is needed just let me know.
Kind regards
Did you try to specify the assembly where your custom control is defined using the following syntax:
xmlns:export="clr-namespace:your.custom.control.namespace;assembly=your.assembly.name"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With