开发者

Using a global ResourceDictionary in a UserControl Library

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

<Application.Resources>

    <ResourceDictionary>
        <ResourceDictionary.MergedDictio开发者_开发技巧naries>
            <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


Check out the pack URI syntax. Something like:

<ResourceDictionary Source="ProjectB;component/MyResourceDictionary"/>


@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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜