简体   繁体   中英

Change background of Windows Store app Visual Studio 2013

I need some help. I'm a new programmer, and I've created a Windows Store application in visual studio 2013. The problem is that I don't know how to change the background of a blank page. I want to set a png image as background, but I really don't know how to do this. Thanks!

Add your Image inside App.Xaml inside the Resources,

<Application.Resources>
    <Style x:Key="PageBg" TargetType="Grid">
          <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="/Assets/yourImage.png"/>
            </Setter.Value>
        </Setter>
    </Style>
</Application.Resources>

In your Page's grid, Just set like this,

<Grid x:Name="LayoutRoot"  Style="{StaticResource PageBg}">
</Grid>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM