I have a simple WPF window. I intend to set it's background to be one of the images I added to project as Embedded Resource. This is what I tried:
<Window x:Class="A_Boggle.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="A-Boggle" Height="300" Width="625" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Name="Game">
<Window.Background>
<ImageBrush ImageSource="background.jpg"></ImageBrush>
</Window.Background>
<Grid>
</Grid>
But with this, i always get this: "Error 1 The file splash.jpg is not part of the project or its 'Build Action' property is not set to 'Resource'."
Any ideas?
Best Answer
Go to the image within VS and set the item to be a Resource. Right click -> Properties -> Build Action -> Resource
Update:
You need to change the path if it is in a folder. ie...Resources/background.jpg