Background image Windows Phone 7

Posted by Xavier on Stack Overflow See other posts from Stack Overflow or by Xavier
Published on 2012-10-18T21:09:57Z Indexed on 2012/10/18 23:01 UTC
Read the original article Hit count: 122

Filed under:

I have a little question, I want to change the background of my application with C#. I tried this code :

var app = Application.Current as App;
var imageBrush = new ImageBrush
{
ImageSource = new BitmapImage(new Uri(imageName, UriKind.Relative))
};
app.RootFrame.Background = imageBrush;

But it doesn't work, the background is dark.. I tried to do :

app.RootFrame.Background = new SolidColorBrush(Colors.Blue);

And it works well. So I don't understand where is the problem, my image is 480*800 px and I set Build Action to Content and Copy to Output Directory to Copy if newer .

Thanks for all

© Stack Overflow or respective owner

Related posts about windows-phone-7