Question

I am developing three kiosk-like applications in WPF. They will share a similar look and feel, and I was hoping to create the projects all in the same solution. What I would like to do is add a project to the solution that just holds shared resources, such as fonts and images.

My question is, is it possible to share resources like embedded fonts across applications, and if so, what is the appropriate project type for this use? (class library? WPF user control?)

Was it helpful?

Solution

I would create a WPF Custom Control Library, then create a ResourceDictionary to hold the resources, where in the App.xaml of your start-up project I would link the Resource dictionary.

 <Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/myResourceLibrary;component/myResourceDictionary.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

That way, you can just move the DLL around to whichever solution you want to use it in.

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