Using resource file from shell project in all my modules

Topics: Prism v1, Prism v2 - Silverlight 2, Prism v2 - WPF 3.5
Mar 12, 2009 at 8:30 AM
Hi,
 
Im having difficulties using my resource file that is located in my shell project.
 
I've defined a resource file in my shell project (styles.xaml).
Now, in my shell project I have added references for all my modules.
 
My question is, how can my modules use the resource file (styles.xaml) that is defined in my shell project?
Is it wise to move the resource file to another project, that can be refed by all modules?
 
What's the best practice for this issue?
 
Thanks.
Mar 12, 2009 at 11:56 AM
Hi Piels,

 You can usualy do something like this in App.xaml

<Application.Resources>
         <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="styles.xaml" />
   </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

And the styles will be avalible to all the views in your modules.

I presonaly add them in a new project let's say resources. And use them like this.
         <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/KaDi.Resources;component/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

But you must add a reference to the Resources project.

Hope this helps.

Have a great day,
Calin
Mar 15, 2009 at 6:14 PM
Hi Piels,

Maybe this discussion http://compositeextensions.codeplex.com/Thread/View.aspx?ThreadId=42919 helps you.

There is also a feature request regarding your question: http://compositewpf.codeplex.com/WorkItem/View.aspx?WorkItemId=3504

jbe