UWP App 不显示图片

UWP App does not show Image

我在显示图像时遇到了一点问题。

图像在资产文件夹中。 这是我的 XAML 代码:

<Page
    x:Class="MyApp.WelcomeScreen"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"  Width="800" Height="480" RequestedTheme="Dark">

    <Grid Background="#C4043F">
        <Image Name="MyPicture" Source="/Assets/LOGO.png" HorizontalAlignment="Left" VerticalAlignment="Top"/>
   </Grid>
</Page>

我也试过像这样以编程方式设置源,但未显示图像。我也试过放置 try-catch 块,但没有抛出异常。

string imagePath = "ms-appx:///Assets/LOGO.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imagePath));
MyPicture.Source = bitmapImage;

我已经尝试过此处描述的所有内容:

我错过了什么?

执行此步骤:

1) 构建操作 设置为 内容

2) 并尝试在图像属性中设置 always **copy to output directory”。