7

In my application I want the user to load an image as the canvas background. How can I assign the image to canvas background?

Hasan Zubairi
  • 1,037
  • 4
  • 23
  • 57

1 Answers1

15

Use ImageBrush to set Canvas.Background property

ImageBrush ib = new ImageBrush();
ib.ImageSource = new BitmapImage(new Uri(@"sampleImages\berries.jpg", UriKind.Relative));
mycanvas.Background = ib;
Colin D
  • 5,641
  • 1
  • 23
  • 35
Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208