如何在 Windows Phone 8 中设置背景图像? [英] How to set background image in Windows Phone 8?

查看:35
本文介绍了如何在 Windows Phone 8 中设置背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 WP 应用程序很陌生,不知道如何在 app.xaml 文件中设置 back-ground 图像以用于Windows Phone 8 应用程序中的整个应用程序.到目前为止,我已经在它上面放置了一些 controls 但未能设置背景图像.我看过一些材料,但没有奏效.任何帮助将不胜感激!

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 !

推荐答案

您可以添加一个以 Image 作为背景的 Common Grid Style.并将其放置在 App.xaml.Resources 下.

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>

这篇关于如何在 Windows Phone 8 中设置背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆