Skip to main content
 首页 » 编程设计

c#之在 UserControl 库中使用全局 ResourceDictionary

2024年02月23日1498°冷暖

我在“App.xaml”中有“Project A”和“MyResourceDictionary.xaml”

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

我还想在我的用户控件库 - “项目 B”中使用“MyResourceDictionary.xaml”

我可以这样做吗?

谢谢, 埃蒙

请您参考如下方法:

查看 pack URI syntax .像这样的东西:

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