我想在一个独立的 dll 中包含一组样式,可以从许多不同的 WOF 类中引用这些样式来定义常见的样式。
我已经创建了独立的 dll 并尝试引用它,但遇到了问题。
这是独立dll的代码:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="myStyle" TargetType="Button">
<Setter Property="Background" Value="Orange" />
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="Padding" Value="8,4" />
<Setter Property="Margin" Value="4" />
</Style>
<!-- store here your styles -->
</ResourceDictionary>
这是我试图引用它的地方:
<src:GX3ClientPlugin.Resources>
<ResourceDictionary Source="pack://application:,,,/GX3StyleResources.dll;component/GX3StyleResources.xaml" />
</src:GX3ClientPlugin.Resources>
运行时出现以下异常:
无法加载文件或程序集“GX3StyleResources.dll,Culture=neutral”或其依赖项之一。该系统找不到指定的文件。
有任何想法吗?