Reputation: 35542
I would like to set a background image for the entire application for Windows Phone 7. I guess the size of the image should be 480 x 800 which I have already.
Should it be set inside App.xaml or WMAppManifest.xaml ? If so, please point me to a code sample.
Upvotes: 0
Views: 5186
Reputation: 291
I don't think you need to set a background image for each page. If you add this snippet to App.xaml :
<ImageBrush x:Key="imgKey" ImageSource="/Images/imgName.png" />
And change the Grid configuration in MainPage.xaml to :
<Grid x:Name="LayoutRoot" Background="{StaticResource imgKey}">
Your image should be displayed on all pages of your app.
Upvotes: 1
Reputation: 13250
Have you tried this way?
private static void SetAppBackground(string imageName)
{
var app = Application.Current as App;
if (app == null)
return;
var imageBrush = new ImageBrush
{
ImageSource = new BitmapImage(new Uri(imageName, UriKind.Relative))
};
app.RootFrame.Background = imageBrush;
}
Upvotes: 3
Reputation: 16361
There is no way to set a background image globally. You need to set it for each page.
Upvotes: 0