Come rendere il BorderThickness riceve il suo valore da una chiave risorsa WPF?
Domanda
cerco di creare String
, risorsa Int32
come qui di seguito, ma non funziona. Ho avuto l'errore dicendo che il valore non può essere convertito.
Se si sa come fare questo aiuto per favore.
<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}" />
Soluzione
Il tipo di BorderThickness
è System.Windows.Thinkness non Int32
<Thickness x:Key="MyKey" >1</Thickness>
In bocca al lupo!
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow