C# 如何缓存下载的图像

C# 如何缓存下载的图像,c#,windows-phone-7,C#,Windows Phone 7,我使用下面的代码直接将所有数据绑定到列表中,包括图像 void ListPostComingsoon_Completed(object sender, ListPostComingsoonCompletedEventArgs e) { ComingSoonList.ItemsSource = e.Result; } 列表结构如下所示 select new post { postid = (int

我使用下面的代码直接将所有数据绑定到列表中,包括图像

void ListPostComingsoon_Completed(object sender, ListPostComingsoonCompletedEventArgs e)
    {
        ComingSoonList.ItemsSource = e.Result;

    }
列表结构如下所示

select new post
              {

                  postid = (int)r.postid,
                  userid = (int)r.userid,
                  NofLikeString = r.NofLike.ToString() + " Likes",
                  title = r.title,
                  startdate = r.startdate.ToString(),
                  enddate = r.enddate.ToString(),
                  image =   "http://localhost:6848/photo/" + r.image

              }).ToList();

如何实现图像缓存(图像下载后会单独显示)

我有一个解决方案给你。是的,我为应用程序创建了它,在应用程序中,我们需要加载、缓存和显示大量的徽标、图标等

它可以用作绑定转换器,所以您甚至不应该更改代码!只需更新你的XAML

请退房,你会喜欢的;)

功能:

  • 磁盘缓存
  • 内存缓存
  • 完全异步
  • 可用作绑定转换器或通过编程从代码中获取
  • 完全开源,分叉和改进它
以下是一个例子:

<Image Source="{Binding ImageUrl, Converter={StaticResource MyAppJetImageLoaderConverter}}"/>

另外,很抱歉,我从另一个问题中复制了我的答案,但windows phone上的图像缓存是一个巨大的问题,我想分享我的解决方案,这样每个人都可以使用它并为开发人员社区改进