2013-05-02 60 views
0

我使用下面的代码直接绑定所有的数据到列表中包括图像如何缓存下载的图像

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(); 

哪有我实现图片缓存(图片下载后单独显示)?

+0

看看这个线程http ://stackoverflow.com/questions/4244662/image-control-asynchronous – outcoldman 2013-05-03 02:01:14

回答

0

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

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

请检查samples in repository,你会爱上它;)

特点:

  • 磁盘
  • 缓存在内存中
  • 完全异步
  • 可用缓存作为绑定转换器或从您的代码
  • 012编程
  • 完全开源,分叉并改进!

这里是例如:

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

P.S.对不起,我从其他问题复制我的答案,但在Windows手机上的图像缓存是一个巨大的问题,我想分享我的解决方案,所以每个人都可以使用它并改善开发者社区