WPF引用图片路径

1、在一个程序集下

 <ImageBrush ImageSource="pack://application:,,,/Resources/unchecked.png" Stretch="UniformToFill" />

这样用没问题

2、在引用外部项目资源的时候

 <ImageBrush ImageSource="pack://application:,,,/space;component/Resources/unchecked.png" Stretch="UniformToFill" />

需要这样使用space是程序集名称,component/固定,后面跟相对路径即可。

具体参考链接
https://www.cnblogs.com/sntetwt/p/5402098.html

猜你喜欢

转载自blog.csdn.net/weixin_41487423/article/details/122877582