protected override void OnMouseMove(MouseEventArgs e) { if (_imageButtons == null) { return; } foreach (var oneImageButton in _imageButtons) { var images = ButtonImages.GetButtonImages(oneImageButton); if (images == null) { return; } if (oneImageButton.IsMouseOver) { var image = images[1]; oneImageButton.Content = image; } else { var image = images[0]; oneImageButton.Content = image; } } base.OnMouseMove(e); }
public static void OnImageButtonMouseOver(DependencyObject d, DependencyPropertyChangedEventArgs e) { var imageButton = d as ImageButton; if (imageButton == null) { return; } var images = ButtonImages.GetButtonImages(imageButton); if (images == null) { return; } if ((bool)e.NewValue) { var image = images[1]; imageButton.Content = image; } else { var image = images[0]; imageButton.Content = image; } }
private static void Button_MouseEnter(object sender, MouseEventArgs e) { var imageButton = sender as ImageButton; if (imageButton != null && ButtonImages.GetButtonImages(imageButton) == null) { ((Button)sender).Margin = new Thickness(-5); } }