I have a WPF application structured according the MVVM pattern. I wish to set the application background image at runtime, loading a file stored in MyProjectView/images/background.jpg. So, in MyProjectViewModel layer I wrote a procedure to load the background image
Public Sub LoadBackground()
Dim fs As New FileStream("images/background.jpg", FileMode.Open, FileAccess.Read)
img = New Byte(fs.Length - 1) {}
fs.Read(img, 0, System.Convert.ToInt32(fs.Length))
End Sub
This code work only in the Debug mode. When I deploy my application, no background is loaded, because the image file is not loaded into the deployed folder "images". I tried to set the "Action" property of the file to "EmbeddedResource", but nothing happens. how can I do to add the background.jpg file into my deployment package?