1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public static class Nom_Du_Label
{
public static readonly DependencyProperty CustomProperty =
DependencyProperty.RegisterAttached(
"Custom", // Nom de la propriété
typeof(string), // Type de la propriété
typeof(Nom_Du_Label), // Classe qui définit la propriété attachée
new PropertyMetaData("")); // Valeur par défaut
// Méthodes pour faciliter l'accès à la valeur en code-behind
public static void SetCustom(DependencyObject obj, string value)
{
obj.SetValue(CustomProperty, value);
}
public static string GetCustom(DependencyObject obj)
{
return (string)obj.SetValue(CustomProperty);
}
} |
Partager