我在 WPF 应用程序中设置了静态资源,如下所示:
<Application x:Class="Demos.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<BitmapImage x:Key="logo" UriSource="Logo.png" />
</Application.Resources>
</Application>
我可以看到在设计时出现的图像,并带有以下声明:
<Image HorizontalAlignment="Left" Height="302" Margin="0,-106,0,0" VerticalAlignment="Top" Width="458" Source="{StaticResource logo}" Grid.RowSpan="2"/>
但是当我运行我的应用程序时,图像没有出现。你知道我做错了什么吗?
提前致谢!
最佳答案
从属性窗口将图像属性设置为资源并始终复制。 希望这能解决您的问题。
关于c# - 静态资源图像在运行时不出现(在设计时出现),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18553481/