2014-05-19 2 views
0

Récemment, j'ai commencé à créer une application Windows Store en XAML et en C#. Malheureusement, j'ai échoué en ajoutant une image png en arrière-plan stockée dans '/ Assets'. J'ai cherché partout des colles mais je n'ai rien trouvé d'utile.Ajout d'une image d'arrière-plan dans Windows Store Apps

Voici mon code:

<Page 
    x:Class="BoggleV01.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:BoggleV01" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 

    <Grid Margin="160,100" Width="1040"> 
     <Grid.Background> 
      <ImageBrush ImageSource="/Assets/Background.png" Stretch="UniformToFill" />            
     </Grid.Background> 

     <StackPanel x:Name="levelsStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260"/> 
     <StackPanel x:Name="playersStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260" Margin="260,0,0,0"/> 
     <StackPanel x:Name="statisticsStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260" Margin="520,0,0,0"/> 
     <StackPanel x:Name="settingsStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260" Margin="780,0,0,0"/> 
    </Grid> 
</Page> 

Répondre

1

vous pouvez utiliser le Mentionnés ci-dessous le code

<ImageBrush ImageSource="/Applicationname;component/Assets/Background.png" 
      Stretch="UniformToFill" /> 
+0

Dhaval, une certaine façon cela n'a pas résolu mon problème, j'ai aussi essayé '' juste au cas où je devrais remplacer Applicationname avec mon espace de noms. – Smoothal

+0

avez-vous remplacer votre nom d'application dans la chaîne applicationname? –

+0

Nom de l'application est l'espace de noms ai-je raison? Dans ce cas, oui, j'ai fait ça. – Smoothal

Questions connexes