- UWP

2016-10-10 14 views
0

私は記憶ゲームを作るしようとしている、コードは以下の通り:- UWP

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

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="1*"/> 
     <ColumnDefinition Width="1*"/> 
     <ColumnDefinition Width="1*"/> 
     <ColumnDefinition Width="1*"/> 
    </Grid.ColumnDefinitions> 

    <Grid.RowDefinitions> 
     <RowDefinition Height="1*"/> 
     <RowDefinition Height="2*"/> 
     <RowDefinition Height="2*"/> 
     <RowDefinition Height="2*"/> 
     <RowDefinition Height="2*"/> 
    </Grid.RowDefinitions> 


    <TextBlock Grid.Row="0" Grid.ColumnSpan="4" FontSize="24" FontStyle="Italic">Memo game by Ido and Jacob</TextBlock> 

    <Rectangle x:Name="R1C1" Grid.Row="1" Grid.Column="0" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R1C2" Grid.Row="1" Grid.Column="1" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R1C3" Grid.Row="1" Grid.Column="2" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R1C4" Grid.Row="1" Grid.Column="3" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 

    <Rectangle x:Name="R2C1" Grid.Row="2" Grid.Column="0" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R2C2" Grid.Row="2" Grid.Column="1" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R2C3" Grid.Row="2" Grid.Column="2" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R2C4" Grid.Row="2" Grid.Column="3" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 

    <Rectangle x:Name="R3C1" Grid.Row="3" Grid.Column="0" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R3C2" Grid.Row="3" Grid.Column="1" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R3C3" Grid.Row="3" Grid.Column="2" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R3C4" Grid.Row="3" Grid.Column="3" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 

    <Rectangle x:Name="R4C1" Grid.Row="4" Grid.Column="0" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R4C2" Grid.Row="4" Grid.Column="1" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R4C3" Grid.Row="4" Grid.Column="2" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
    <Rectangle x:Name="R4C4" Grid.Row="4" Grid.Column="3" Fill="Gray" StrokeThickness="2" Margin="4" Stroke="Black"></Rectangle> 
</Grid> 
しかし

、私は画像を追加するとき、Iそれを見ることはできません。絵が存在し、

 <Image Source="c:\users\prinsnal\documents\visual studio 2015\Projects\MemoGame\MemoGame\Assets\I3LeJ3H.png" Grid.Row="0" Grid.Column="0"></Image> 

何も表示されていないと私は、私は絵を見ることができるように何をすべき、資産からそれをドラッグ:私は以下のように画像を設定しますか?写真とテキストブロックまたはボタンを同じパネルに配置する必要がありますか?

+0

あなたのイメージを選択して存在しますがありました[Image.Source](https://msdn.microsoft.com/library/windows/apps/xaml/windows.ui.xaml.controls.image.source.aspx)ページのサンプルをご覧ください。 –

答えて

0

これを試してみてください:

<Image Source="Assets\I3LeJ3H.png" Grid.Row="0" Grid.Column="0"></Image> 

画像が資産ディレクトリ内のVisual Studioで追加しなければなりません。そうでない場合は、次の

  1. のVisual Studioでの資産のディレクトリをクリックしてください
  2. を追加要素

It works for me