Creating Images from an Embedded Resource

安稳与你 提交于 2019-12-05 09:39:12

First thing to note is that there is an DownloadError event that you ought to subscribe to, this might explain what is happening and why (though sometimes the error message is rather generic); the next is that you might not need the pack:// URI construct with images build actions of Resource:

var bmpImage = new BitmapImage(new Uri(
    string.Format("/Images/{0}.png", name", UriKind.Relative));

The Pack URI is wrong, where you name your assembly you should place an authority, in this case application, i.e.

string filePath = "pack://application:,,,/Images/" + name + ".png";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!