I had set background image in XAML file. I had added Mouse Enter Event listener. And added the code:
var image = new ImageBrush();
image.ImageSource = new BitmapImage(new Uri("Images/buttonHover.png", UriKind.Relative));
this.Background = image;
But it is throwing DirectoryNotFound
Exception. I do not know how to get the image from the folder. My project consists of a folder named Images
.
How can i access the image from the Images folder?
EDIT
private void button1_MouseEnter(object sender, MouseEventArgs e)
{
var image = new ImageBrush();
image.ImageSource = new BitmapImage(new Uri("/WordFill;component/Images/buttonHover.png", UriKind.Relative));
this.Background = image;
}
Thanks