Wiki


Wiki Table of Contents

Page Details

First published by:
Last revision by:
This page has not yet been rated

Silverlight Tip of the Day #102 - Bypassing the Image Cache

Filed under: [Edit Tags]

Mặc định Silverlight sẽ không download một hình ảnh image nhiều hơn một lần nếu được chứa trong image cache. Tức là, miễn là  URI vẫn giống nhau, nó sẽ tham chiếu các image từ bộ nhớ đệm(cache).

Vậy sẽ thế nào nếu hình ảnh trên máy chủ server thay đổi mặc dù URI vẫn giữ nguyên? Ứng dụng của bạn có thể dẫn đến một update bằng cách gán giá trị thuộc tính IgnoreImageCache thành true.

Thí dụ:

Image img = new Image();
Uri uri = new Uri("http://YourServer.com/MyImage.png", UriKind.Absolute);
BitmapImage bi = new System.Windows.Media.Imaging.BitmapImage(uri);
bi.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
img.Source = bi;
LayoutRoot.Children.Add(img);

 


Thank you,
--Mike Snow

Recent Comments

Leave the first comment for this page.