BitmapImage.CacheOption 속성

정의

이 인스턴스BitmapCacheOptionBitmapImage 사용할 을 가져오거나 설정합니다.

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

속성 값

BitmapCacheOption 사용되는 것입니다 BitmapImage. 기본값은 Default입니다.

예제

다음 코드 예제에서는 코드를 사용하여 a를 CacheOptionBitmapImage 설정하는 방법을 보여 줍니다.

// 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)

설명

CacheOptionBitmapCacheOption.OnLoad 만드는 BitmapImage데 사용되는 스트림을 닫으려면 이 값을 설정합니다. 기본 OnDemand 캐시 옵션은 이미지가 필요할 때까지 스트림에 대한 액세스를 유지하고 정리는 가비지 수집기에서 처리합니다.

종속성 속성 정보

항목 가치
식별자 필드 CacheOptionProperty
메타데이터 속성이 다음으로 설정됩니다. true None

적용 대상

추가 정보