Why isn't StaticResource for image found at runtime?
我已经在我的Resources.resx文件中添加了一个图像。 我这样引用它:
1 | <Image Source="{Binding MyImage}"/> |
在设计器中,我确实在上面看到一条弯曲的蓝线。 它说
The resource"MyImage" could not be resolved.
在运行时,它将引发以下错误:
Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an
exception.
有什么想法我做错了吗?
不要在WPF中使用
在文件属性中将"构建操作"设置为"资源":
然后直接引用该文件:
那里不需要