Splitting Generic.Xaml-加载MergedDictionaries时遇到问题

问题描述 投票:6回答:1

在相当大的控件库上工作,generic.xaml使simpy失去了控制。我想通过控制对其进行拆分(尽管对于现在仅包含一些简单名称空间的名称空间来说,是一次)。

为此,我要添加更多的资源字典。

然后,在generic.Xaml中添加:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Themes/Generic.Core.xaml" />
</ResourceDictionary.MergedDictionaries>

并且...出现加载错误。

正确的URL是什么?

这是:

  • 仅包含控件(而不是exe或其他内容)的dll文件中。
  • generic.Xaml和另一个(现在:Generic.Core.xaml)位于同一程序集中,位于同一文件夹中。

我阅读了有关包URL的MSDN部分,但是对于看起来如此简单的东西来说,听起来确实很复杂。

;)请帮助。

wpf themes generic.xaml
1个回答
14
投票

发现它:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Tradex.Presentation;component/Themes/Generic.Core.xaml" />
</ResourceDictionary.MergedDictionaries>

行得通。需要为程序集加上前缀(用程序集名称替换Tradex.Presentation)并以component项开头。

© www.soinside.com 2019 - 2024. All rights reserved.