C# 当我启动项目时,图像不会';t载荷

C# 当我启动项目时,图像不会';t载荷,c#,wpf,C#,Wpf,我将图像添加到窗口,当我启动项目时,图像不会加载 XAML代码: <Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Heigh

我将图像添加到窗口,当我启动项目时,图像不会加载

XAML代码:

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Image HorizontalAlignment="Left" Height="188" Margin="88,64,0,0" VerticalAlignment="Top" Width="288">
            <Image.Source>
                <BitmapImage UriSource="image1.png"/>
            </Image.Source>
        </Image>
        <Rectangle Fill="#FF2424C7" HorizontalAlignment="Left" Height="100" Margin="338,24,0,0" Stroke="Black" VerticalAlignment="Top" Width="125"/>
    </Grid>
</Window>


我可以在Visual Studio designer中看到该图像:


映像文件存在于解决方案目录中:


确保图像已复制到输出文件夹。在Visual Studio中(我只有2010作为参考),查看图像文件的属性,并确保
Copy to Output Directory
设置为“Copy if newer”


您可以通过查看
bin
目录来检查是否正在复制图像。这应该是项目目录下的
bin\Debug
bin\Release

执行目录中是否存在
image1.png
?如何添加图像、资源?松散文件?你是否将它们包括在项目中?是的,它在文件夹中。不要将你的截图作为答案发布!改为编辑您的问题并将其添加到此处。@user3637574:您可以尝试从解决方案资源管理器中删除该问题,然后尝试添加现有文件。很可能,synci的资源有visual studio ultimate 2013,但我在属性中没有像您这样的选项。你知道其他解决方法吗?或者在哪里可以找到这个选项?坦克