【发布时间】:2014-07-31 13:52:46
【问题描述】:
我有一个Class Library,其中包含以下代码。
下面是我的UserControl的Resource:
<UserControl.Resources>
<ResourceDictionary Source="pack://application:,,,/Mine.Controls;component/Templates.xaml" />
</UserControl.Resources>
下面是我的ResourceDictionary 文件,名为Templates.xaml:
构建操作:资源
复制到...:不要复制
自定义工具:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate x:Key="MyButton"
TargetType="Button">
<Border x:Name="buttonBorderOuter"
BorderBrush="#DBDBDB"
BorderThickness="1"
Background="#00ECECEC"
CornerRadius="5" />
</ControlTemplate>
</ResourceDictionary>
然后我得到错误
异常:查找资源字典“pack://application:,,,/Mine.Controls;component/Templates.xaml”时出错。
我做错了什么?
【问题讨论】:
-
你用过 Visual 2012
标签: c# wpf xaml resourcedictionary class-library