Windows phone 7 从web加载.ico并转换为BitmapSource
我正在尝试从web加载.ICO类型的文件,并将其用作windows phone中的图像。但我在尝试设置BitmapImage的源时出错。这是我的密码:Windows phone 7 从web加载.ico并转换为BitmapSource,windows-phone-7,bitmapimage,ico,Windows Phone 7,Bitmapimage,Ico,我正在尝试从web加载.ICO类型的文件,并将其用作windows phone中的图像。但我在尝试设置BitmapImage的源时出错。这是我的密码: WebClient client = new WebClient(); client.OpenReadCompleted += (s, e) => { if (e.Cancelled) return; if (null != e.Error) throw e.Error; BitmapImage image
WebClient client = new WebClient();
client.OpenReadCompleted += (s, e) => {
if (e.Cancelled) return;
if (null != e.Error) throw e.Error;
BitmapImage image = new BitmapImage();
image.SetSource(e.Result);
this.Favicon = image;
};
client.OpenReadAsync(new Uri(@"http://mysite/myimage.ico", UriKind.RelativeOrAbsolute));
BitmapImage是否支持“ico”文件?如何将“ico”转换为受支持的位图文件
该解决方案必须在Windows Phone 7上运行
TksBitmapImage所支持的唯一格式似乎是PNG和JPG 此处未完全说明,但评论中暗示: .ico处理的silverlight实现如下:
您可能必须对其进行修改,使其与Windows Phone 7上的silverlight版本兼容。遗憾的是,它实际上不受支持(),而且此实现无法完美工作。。。我正在使用来自www.getfavicon.org的服务。。。