我尝试创建 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}" />
有帮助吗?

解决方案

类型 BorderThicknessSystem.Windows.Thinkness 不是 Int32

<Thickness x:Key="MyKey" >1</Thickness>

祝你好运!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top