//initialize the canvas public void initializeCanvas() { importImage.Source = null; paintSurface.UpdateLayout(); myImage = new DisplayedImagePath() { imagePath = "pack://application:,,,/Images/white.jpg" }; BitmapImage insertImage = new BitmapImage(); insertImage.BeginInit(); insertImage.UriSource = new Uri(myImage.imagePath); insertImage.EndInit(); importImage.Source = insertImage; }
private void btnOpenImage_Click(object sender, RoutedEventArgs e) { clearCanvas(); importImage.Source = null; paintSurface.UpdateLayout(); imageFilePath = ""; getFilePath(); if (imageFilePath != "") { myImage = new DisplayedImagePath() { imagePath = imageFilePath }; BitmapImage insertImage = new BitmapImage(); insertImage.BeginInit(); insertImage.UriSource = new Uri(myImage.imagePath); insertImage.EndInit(); importImage.Source = insertImage; } }