private static void OnImageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
var control = d as UIElement;
if (control == null) return;
if (e.OldValue == null) {
control.MouseLeftButtonDown += Control_MouseDown;
} else if (e.NewValue == null) {
control.MouseLeftButtonDown -= Control_MouseDown;
}
}