1

I have have "Project A" with "MyResourceDictionary.xaml" in "App.xaml"

<Application.Resources>

    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="MyResourceDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

</Application.Resources>

I want to also use "MyResourceDictionary.xaml" in my user control library - "Project B"

Can I do this?

Thanks, Eamonn

Godisemo
  • 1,813
  • 2
  • 18
  • 26
Eamonn McEvoy
  • 8,876
  • 14
  • 53
  • 83

2 Answers2

2

Check out the pack URI syntax. Something like:

<ResourceDictionary Source="ProjectB;component/MyResourceDictionary"/>
Kent Boogaart
  • 175,602
  • 35
  • 392
  • 393
  • Hi Kent, Thanks for the reply, think I am getting somewhere but I'm getting an error saying it cant find the resource dictionary :s – Eamonn McEvoy Mar 01 '11 at 09:29
2

@Kent Boogaart

Thanks for the help Kent, here is the working code

<UserControl.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/ProjectA;component/MyResourceDictionary.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</UserControl.Resources>

anyone else having trouble with this check out this link - http://msdn.microsoft.com/en-us/library/aa970069.aspx

Thanks, Eamonn

Eamonn McEvoy
  • 8,876
  • 14
  • 53
  • 83