【发布时间】:2012-05-02 21:09:33
【问题描述】:
有没有办法通过 WPF 样式设置图像大小?
我的 XAML 中有:
<Image Style="MyImageStyle" Source="{StaticResource MyImage}" />
并在 ResourceDictionary 中作为样式:
<Style x:Key="MyImageStyle">
<Setter Property="Width" Value="30" />
但它不起作用。我收到此错误:无法解析样式属性“宽度”。验证所属类型是否为 Style 的 TargetType,或使用 Class.Property 语法指定 Property。
谢谢。
【问题讨论】:
-
可能想了解更多关于styling...