有什么方法可以通过 WPF 样式设置图像大小?
我的 XAML 中有:
<Image Style="MyImageStyle" Source="{StaticResource MyImage}" />
在 ResourceDictionary 作为一种风格:
<Style x:Key="MyImageStyle">
<Setter Property="Width" Value="30" />
但它不起作用。我收到此错误:无法解析样式属性“宽度”。验证所属类型是否为 Style 的 TargetType,或使用 Class.Property 语法来指定 Property。
谢谢。