【发布时间】:2018-10-08 10:09:57
【问题描述】:
我正在尝试将项目中的图标直接加载到主目录中。 为了做到这一点,我这样做:
Dim uriSrc As Uri = New Uri("pack://ELE100WalkerWPF:,,,/assemblyName;Component/ShowMCF.png")
Dim bitmapImage As BitmapImage = New BitmapImage With {.UriSource = uriSrc}
Dim image As System.Windows.Controls.Image = New System.Windows.Controls.Image() With {.Source = bitmapImage}
即使对于我的样式我以相同的方式引用它们,这也根本不起作用:
<ResourceDictionary Source="pack://application:,,,/ELE100WalkerWPF;component/Resources/Colors.xaml" />
唯一的区别是我的样式是在 application.xaml 的 MergeDictionary 中定义的,像这样
<ResourceDictionary Source="Resources/Colors.xaml" />
有人可以解释为什么图像没有显示以及我该如何解决这个问题?提前致谢
【问题讨论】:
标签: wpf vb.net resources icons