如何使BorderThickness从WPF资源密钥中获得其价值?
题
我尝试创建 String
, Int32
资源如下,但行不通。我遇到了一个错误,说该值无法转换。
如果您知道该怎么做,请提供帮助。
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<sys:Int32 x:Key="MyKey">1</sys:Int32>
</ResourceDictionary>
<Label Content="abb" BorderThickness="{StaticResource MyKey}" />
解决方案
类型 BorderThickness
是 System.Windows.Thinkness 不是 Int32
<Thickness x:Key="MyKey" >1</Thickness>
祝你好运!
不隶属于 StackOverflow