Question

J'essaie de créer String, ressource Int32 comme ci-dessous, mais il ne fonctionne pas. Je suis l'erreur en disant que la valeur ne peut pas être convertie.

Si vous savez comment faire cette aide s'il vous plaît.

<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}" />
Était-ce utile?

La solution

Le type de BorderThickness est System.Windows.Thinkness pas Int32

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

Bonne chance!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top