2016-11-21 68 views
0
背景图像

我是新来的Windows手机的发展,我有设立一个UserControl.I内的背景图像的困难想拥有它作为一个静态资源,图像是只对特定的XAML文件。它已经存储 在我的项目的资产文件夹。下面我的代码仍然无法看到在预览窗口中定义内部用户控件

我的形象这是我的XAML文件:资源集合中

<UserControl 
x:Class="OrangePulse.LoginControl" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:OrangePulse" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" 
d:DesignHeight="800" 
d:DesignWidth="500"> 

<UserControl.Resources> 

    <BitmapImage x:Key="splashScreen" UriSource="/Assets/loginBgd.png"/> 
</UserControl.Resources> 

回答

0

在你的代码中只添加图像。

<UserControl.Resources> 
    <BitmapImage x:Key="splashScreen" UriSource="/Assets/loginBgd.png"/> 
</UserControl.Resources> 

你有这个资源绑定到任何控件来显示图像...就像如果你添加的打击线下也将显示图像..

<UserControl.Resources> 
    <BitmapImage x:Key="splashScreen" UriSource="/Assets/loginBgd.png"/> 
    </UserControl.Resources> 
**<Image Source="{StaticResource splashScreen}"/>**