This project is read-only.

Pause Image on MouseEnter Solution

Dec 1, 2010 at 2:20 AM

Just thought I'd share this little snippet. You can update the ImageViewer.cs with the following to get the image viewer to pause when you mouse over the image.

ImageViewer.cs

if (ImageElement != null) //LINE 89 
{
	ImageElement.ImageFailed += delegate
	{
		BitmapImage blankBmp = new BitmapImage();
		blankBmp.SetSource(Application.GetResourceStream(new Uri("Vertigo.SlideShow;component/Resources/Blank.jpg", UriKind.Relative)).Stream);
		ImageElement.Source = blankBmp;
	};
	ImageElement.MouseEnter += new System.Windows.Input.MouseEventHandler(ImageElement_MouseEnter); //ADDED THIS LINE
	ImageElement.MouseLeave += new System.Windows.Input.MouseEventHandler(ImageElement_MouseLeave); //ADDED THIS LINE

ADDED THESE LINES BELOW

void ImageElement_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)        
{            
	Navigation.Play();        
}

void ImageElement_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)        
{            
	Navigation.Pause();        
}