Reputation: 10145
I've an Image Control in a WPF Form. When there's no image loaded. I want to make it dark gray but all of the controls have the Background exept the Image control.
Does anybody knows how can I set a background to the image control in the XAML?
Upvotes: 12
Views: 20658
Reputation: 12652
You can just surround your image with border:
<Border Height="300" Width="300" Background="Gray">
<Image Stretch="Fill" />
</Border>
Upvotes: 27
Reputation: 1413
This is how I do it: use a PNG file as a background
<Image Source="Background.png" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
Upvotes: 1