1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public string ImageChemin {
get { return (string)GetValue(ImageCheminProperty); }
set { SetValue(ImageCheminProperty, value); }
}
public static readonly DependencyProperty ImageCheminProperty =
DependencyProperty.Register(
"ImageChemin",
typeof(string),
typeof(BlocImage),
new FrameworkPropertyMetadata(null, new PropertyChangedCallback(ImageCheminPropertyChanged))
);
public static void ImageCheminPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
BlocImage ctrl = d as BlocImage;
if (ctrl != null) {
string strChemin = e.NewValue as string;
if (!string.IsNullOrEmpty(strChemin)) {
// Utilisation de la variable pour affecter la source de l'image
}
}
} |
Partager