Question

I have a solution which loads a WPF App that Holds multiple resource dictionaries as merged ones. One of them contains converters, some certain collection, templates. Others contain templates and other stuff. Some of the dictionaries are loaded from other compiled DLLs.

My problem is that certain dictionaries require to use resources from other dictionaries. Although I could reference them, I would like to avoid that. I would like to have them to access each other in a centralized way.

Is there a way to do this already, that I am missing, or can someone point me to a article conceerning this?. I was googleing but found nothing

EDIT

This solution worked fine, until the moment I tried using a converter as a DynamicResource in a binding. Any sugestions?

<Image Margin="0" Width="20" DockPanel.Dock="Left" StretchDirection="Both"
                       Source="{Binding MessageCode, Converter={DynamicResource MessageImageConverter}, ConverterParameter=True, FallbackValue='0'}"
                       />

this is the code

Was it helpful?

Solution

Use "{DynamicResource myresource}" instead of "{StaticResource myresource}".

If your assembly A.exe has the required dictionaries in its wpf tree, then sub-controls of referenced assembly B.dll will find required resource.

You will not see the expected result in WPF designer, though.

OTHER TIPS

Perhaps using a dependency injection framework. WPF utilizes Unity/Prism as it's default framework of choice. You could leverage that same concept in your dll's

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top