2
votes

I am using WPF Interoperability (ElementHost) to display a XAML control in WinForms. This works perfectly for my needs as I must use WinForms for a project I am working on. The issue is that when I add images, such as icons, to the Ribbon in XAML, I can no longer add the XAML Ribbon to the WinForm. The error I keep getting is:

An error occurred trying to create an object of type 'WPF.Ribbon'. Make sure the type has a default constructor.

The images have a Build Action of "Resource". Here is an example XAML code snippet I am using for my ribbon code:

<RibbonButton SmallImageSource="/App/Images/Ribbon/cut.png" Label="Cut" KeyTip="X" />

When I remove the image source, I can compile the code fine, and the ribbon displays without any issue.

1

1 Answers

2
votes

The resolution is to add absolute addresses, such as:

<RibbonButton SmallImageSource = "C:\Path To Images\App\Images\Ribbon\cut.png" Label="Cut" KeyTip="X" />