We're building an Add-In (C#) whose buttons open up quite a few different dialogs. Some of these dialogs are instantiated directly from a view in the Add-In project, and others are instantiated from views that exist in other referenced projects. The icons in question all exist within a different project.
No matter the specific case, these icons are not showing up in the dialogs opened within the Add-In. Even so, they DO show up in the XAML editor. The only way we've been able to get icons to show up is to place them directly into an Images folder within the Add-In's project. This is fine in a couple of cases, but in general it doesn't work because we're using Dialogs that exist in our common / core set of projects. These dialogs and their respective icons work just fine in every other WPF application.
Is there some way around this issue, other than pulling all of those dialogs and their respective images into our Add-In's project's code? We're using the typical Source="pack://application:,,,/Assembly;component/path" referencing scheme in the Source attribute of the Image element in the XAML of these dialogs.
Hi David,
I see this problem now too. Upon investigation - Images referenced using the Pack URI will display only when the dll is loaded and in memory. In this case, the dll is not loaded and hence the resource dictionary that Pro has in memory does not contain your image. There are 2 ways (probably more) to get this to work -
1. Create a class in your resource dll that you instantiate in your add-in's module class. This will load the resource dll when the add-in is loaded, which will allow the image to be displayed.
2. In your module class's initialize override, load the resource assembly using the code snippet below.
Thanks
Uma