Dynamic canvas image wpf

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

+6
source share
1 answer

Use ImageBrush to set the Canvas.Background property.

ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(@"sampleImages\berries.jpg", UriKind.Relative)); mycanvas.Background = ib; 
+12
source

Source: https://habr.com/ru/post/912281/


All Articles