更新时间:2023-11-23 09:12:58
在 UWP 中,您必须指定命名空间才能实现此目的.此外,我发现 XAML 资源词典仅在属性"部分中标记为页面"时才以这种方式引用.
In UWP you must specify the namespace to achieve this. Also, I've found XAML Resource Dictionaries only reference this way if they are marked "Page" in the Property section.
然后在您的应用程序 xaml 中:
Then in your Application xaml:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Default.Namespace.External.Assembly/FolderPathOffRoot/Brushes.xaml"/>
</Application.Resources>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
不要对 ms-appx 感到困惑,它指的是您的包,而不仅仅是包含应用程序的项目.
And don't be confused about ms-appx, it refers to your package, not just the project containing the application.