BitmapImage.CacheOption Özellik

Tanım

bu örneği BitmapCacheOptioniçin kullanılacak öğesini BitmapImage alır veya ayarlar.

public:
 property System::Windows::Media::Imaging::BitmapCacheOption CacheOption { System::Windows::Media::Imaging::BitmapCacheOption get(); void set(System::Windows::Media::Imaging::BitmapCacheOption value); };
public System.Windows.Media.Imaging.BitmapCacheOption CacheOption { get; set; }
member this.CacheOption : System.Windows.Media.Imaging.BitmapCacheOption with get, set
Public Property CacheOption As BitmapCacheOption

Özellik Değeri

BitmapCacheOption için BitmapImagekullanılan. Varsayılan değer: Default.

Örnekler

Aşağıdaki kod örneği, kodu kullanarak öğesinin CacheOptionBitmapImage nasıl ayarlandığını gösterir.

// Define a BitmapImage.
Image myImage = new Image();
BitmapImage bi = new BitmapImage();

// Begin initialization.
bi.BeginInit();

// Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand;
bi.CreateOptions = BitmapCreateOptions.DelayCreation;
bi.DecodePixelHeight = 125;
bi.DecodePixelWidth = 125;
bi.Rotation = Rotation.Rotate90;
MessageBox.Show(bi.IsDownloading.ToString());
bi.UriSource = new Uri("smiley.png", UriKind.Relative);

// End initialization.
bi.EndInit();
myImage.Source = bi;
myImage.Stretch = Stretch.None;
myImage.Margin = new Thickness(5);
' Define a BitmapImage.
Dim myImage As New Image()
Dim bi As New BitmapImage()

' Begin initialization.
bi.BeginInit()

' Set properties.
bi.CacheOption = BitmapCacheOption.OnDemand
bi.CreateOptions = BitmapCreateOptions.DelayCreation
bi.DecodePixelHeight = 125
bi.DecodePixelWidth = 125
bi.Rotation = Rotation.Rotate90
MessageBox.Show(bi.IsDownloading.ToString())
bi.UriSource = New Uri("smiley.png", UriKind.Relative)

' End initialization.
bi.EndInit()
myImage.Source = bi
myImage.Stretch = Stretch.None
myImage.Margin = New Thickness(5)

Açıklamalar

CacheOption oluşturmak BitmapCacheOption.OnLoadiçin BitmapImage kullanılan bir akışı kapatmak istiyorsanız olarak ayarlayın. Varsayılan OnDemand önbellek seçeneği, görüntü gerekli olana kadar akışa erişimi korur ve temizleme çöp toplayıcı tarafından işlenir.

Bağımlılık Özelliği Bilgileri

Öğe Değer
Tanımlayıcı alanı CacheOptionProperty
Meta veri özellikleri olarak ayarlandı true Hiçbiri

Şunlara uygulanır

Ayrıca bkz.