On button click I want to change the canvas image(background image) to another image which is in a folder(images is the folder name). This is what I have tried:
private void Button_Click_2(object sender, RoutedEventArgs e)
{
drawingCanvas.Children.Clear();
ImageBrush imageBrush = new ImageBrush();
imageBrush.ImageSource = new BitmapImage((new Uri(@"../Images/canvas.png", UriKind.Relative)));
drawingCanvas.Background = imageBrush;
}
First I'm clearing the contents of the canvas, deleting the previous image. Now want to set the background to another image. error: URI not handled exception. Any solutions will be appreciated. Thanks.