Fly*_*del 15 c# wpf user-controls resourcedictionary
我正在尝试ResourceDictionary在WPF UserControl库项目中创建一个内部.当我添加以下样式时:
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="{StaticResource ResourceKey=GreyBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource ResourceKey=LightBlueBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ResourceKey=OrangeBrush}"/>
</Trigger>
<EventTrigger RoutedEvent="Click">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.Color" To="{StaticResource ResourceKey=LightOrange}" Duration="0:0:.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)
我收到一个错误说:
The type 'x:Type' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Run Code Online (Sandbox Code Playgroud)
我宣布x为:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Run Code Online (Sandbox Code Playgroud)
这在我在WPF应用程序项目中创建资源字典时有效,但不在UserControl库项目中创建.知道为什么吗?
| 归档时间: |
|
| 查看次数: |
12183 次 |
| 最近记录: |