开发者

How to make the BorderThickness receive its value from a WPF resource key?

开发者 https://www.devze.com 2023-01-23 06:18 出处:网络
I try to create String, Int32 resource as below but it doesn\'t work. I got the error saying that the value can\'t be converted.

I try to create String, Int32 resource as below but it doesn't work. I got the error saying that the value can't be converted.

If you know how to do this please help.

<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>
</ResourceD开发者_如何学Goictionary>

<Label Content="abb" BorderThickness="{StaticResource MyKey}" />


The type of BorderThickness is System.Windows.Thinkness not Int32

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

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消