图像不会在运行时显示

时间:2014-03-18 12:43:51

标签: xaml windows-phone-8

我在Windows Phone 8中出现了一个十分奇怪的问题,因为当我在Xaml中设置图像源时它在设计器视图中正确显示但是当我运行应用程序时没有出现图像我已经创建了一个新的空应用程序。 / p>

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <Image Visibility="Visible" Source="Assets\Tiles\FlipCycleTileMedium.png" HorizontalAlignment="Left" Height="321" Margin="61,192,0,0" VerticalAlignment="Top" Width="359"/>
</Grid>  

1 个答案:

答案 0 :(得分:0)

这是我现在使用的XAML代码:只需用您的代码替换您的MainPage.xaml并运行您的app。你肯定会在应用程序中看到图像。这是截图。

enter image description here

<phone:PhoneApplicationPage
x:Class="PhoneApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Image Visibility="Visible" Source="Assets\Tiles\FlipCycleTileMedium.png" HorizontalAlignment="Left" Height="321" Margin="61,192,0,0" VerticalAlignment="Top" Width="359"/>
    </Grid>
</Grid>