2016-11-21 11 views
0

私はWindows Phone開発を初めて使い、UserControl内に背景画像を設定するのが難しいです。静的リソースとして持っていたい、画像はその特定のxamlファイル。私のプロジェクトのAssetsフォルダに既に が保存されています。リソースコレクションであなたのコード内のUserControl内で背景画像を定義する

<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

だけ追加した画像:まだ私以下のコードは、プレビューウィンドウ

に私の画像を見ることができないでここに私のXAMLファイルです。

<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}"/>**