【发布时间】:2016-02-02 09:15:29
【问题描述】:
在一个 Windows UWP 应用项目中,我试图通过分配给它的 Left、Top、Right 和 Bottom 属性来定义厚度:
<Setter Property="Margin">
<Setter.Value>
<Thickness Left="{StaticResource SomeDouble}"
Top="0"
Right="0"
Bottom="0" />
</Setter.Value>
</Setter>
This answer 似乎暗示这在 WPF 中是可能的,但是,在我的 UWP 项目(以及 WinRT 应用程序)中,我收到以下错误:
XAML Thickness type cannot be constructed.
In order to be constructed in XAML, a type cannot be abstract, interface, nested, generic
or a struct, and must have a public default constructor.
有没有办法使用资源来定义厚度?
【问题讨论】:
标签: xaml windows-runtime uwp