Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set background image in Windows Phone 8?

I am very new to WP apps and don't know how to set the back-ground image in app.xaml file for whole application in Windows Phone 8 app. Up-till now, i have placed some controls over it but fail to set background image. I have seen some material but did not work. Any help will be appreciated !

like image 729
Baqer Naqvi Avatar asked Feb 25 '14 11:02

Baqer Naqvi


People also ask

Is Windows 8 phone still supported?

Customers can upgrade eligible Windows Phone 8.1 devices to Windows 10 Mobile, but should note that support for all versions of Windows 10 Mobile will end after December 2019. Devices upgraded to Windows 10 Mobile will receive security and servicing updates while it is still supported.


1 Answers

You can add a Common Grid Style which uses Image as background.And place it under App.xaml.Resources.

<Application.Resources>
    <Style x:Key="LayoutGridStyle" TargetType="Grid">
          <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="/Assets/bgImage.jpg"/>
            </Setter.Value>
        </Setter>
    </Style>
</Application.Resources>

And use it for the Root grid of your page.

<Grid x:Name="LayoutRoot"  Style="{StaticResource LayoutGridStyle}">
//Content goes here
</Grid>
like image 199
asitis Avatar answered Sep 23 '22 20:09

asitis