Setting the background for image management

I have an image control in WPF form. When the image is not loaded. I want to make it dark gray, but all controls have a different background than the Image control.

Does anyone know how I can set the background for image management in XAML?

+4
source share
2 answers

You can simply surround your image with a border:

<Border Height="300" Width="300" Background="Gray"> <Image Stretch="Fill" /> </Border> 
+9
source

Here is how I do it: use PNG file as background

 <Image Source="Background.png" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> 
+1
source

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


All Articles