BitmapImage.CacheOption 속성

정의

BitmapCacheOption의 이 인스턴스에 사용할 BitmapImage을 가져오거나 설정합니다.

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

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

예제

다음 코드 예제에서는 설정 하는 방법에 설명 합니다 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 없음

적용 대상

추가 정보