.net core 3.0 中 WPF 中的图像标记不起作用

Image tag in WPF in .net core 3.0 not working

我正在使用 .net core 3.0 预览版开发 WPF 应用程序。

我在 .net core 3.0 preview.net framework 中都尝试了以下 xaml 代码行。

<Grid>
    <Image Source="system-tray.jpg"/>
</Grid>

这在 .Net Framework 中工作正常但在 .Net Core 3.0 preview

中不起作用

任何想法!..

对于那些将来来这里寻找答案的人,就像我一样,这里是要检查的东西:

确保 Visual Studio 中图像文件的构建操作设置为“Resource”。这可以通过在解决方案资源管理器中右键单击图像文件并选择 "Properties".

来检查

来源:github.com/dotnet/wpf/issues/292 Clemens 对每个问题的评论