问题
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
回答1:
Check out the pack URI syntax. Something like:
<ResourceDictionary Source="ProjectB;component/MyResourceDictionary"/>
回答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
来源:https://stackoverflow.com/questions/5144435/using-a-global-resourcedictionary-in-a-usercontrol-library