RenderOptions.SetCachingHint(DependencyObject, CachingHint) 메서드

정의

지정된 종속성 개체에 대한 CachingHint 연결된 속성의 값을 설정합니다.

public:
 static void SetCachingHint(System::Windows::DependencyObject ^ target, System::Windows::Media::CachingHint cachingHint);
public static void SetCachingHint (System.Windows.DependencyObject target, System.Windows.Media.CachingHint cachingHint);
static member SetCachingHint : System.Windows.DependencyObject * System.Windows.Media.CachingHint -> unit
Public Shared Sub SetCachingHint (target As DependencyObject, cachingHint As CachingHint)

매개 변수

target
DependencyObject

CachingHint 속성의 값을 설정할 종속성 개체입니다.

cachingHint
CachingHint

속성에 설정할 새 값입니다.

예외

지정된 targetnull입니다.

예제

다음 예제에 대 한 캐싱 힌트 옵션을 사용 하는 방법을 보여 줍니다는 DrawingBrush합니다.

DrawingBrush drawingBrush = new DrawingBrush();
            
// Set the caching hint option for the brush.
RenderOptions.SetCachingHint(drawingBrush, CachingHint.Cache);

// Set the minimum and maximum relative sizes for regenerating the tiled brush.
// The tiled brush will be regenerated and re-cached when its size is
// 0.5x or 2x of the current cached size.
RenderOptions.SetCacheInvalidationThresholdMinimum(drawingBrush, 0.5);
RenderOptions.SetCacheInvalidationThresholdMaximum(drawingBrush, 2.0);
Dim drawingBrush As New DrawingBrush()

' Set the caching hint option for the brush.
RenderOptions.SetCachingHint(drawingBrush, CachingHint.Cache)

' Set the minimum and maximum relative sizes for regenerating the tiled brush.
' The tiled brush will be regenerated and re-cached when its size is
' 0.5x or 2x of the current cached size.
RenderOptions.SetCacheInvalidationThresholdMinimum(drawingBrush, 0.5)
RenderOptions.SetCacheInvalidationThresholdMaximum(drawingBrush, 2.0)

설명

기본적으로 WPF는 및 VisualBrush 개체의 DrawingBrush 렌더링된 콘텐츠를 캐시하지 않습니다. 장면의 내용이나 브러시 사용이 모두 변경되지 않는 정적 시나리오에서는 캐싱이 비디오 메모리를 절약하기 때문에 캐싱이 아니라 이점을 제공합니다. 정적 콘텐츠가 포함된 브러시를 비정적 방식으로 사용하는 경우 WPF의 기본 동작은 콘텐츠가 교환되지 않더라도 모든 프레임마다 브러시의 모든 콘텐츠를 다시 렌더링하는 것입니다. 예를 들어,이 동작이 발생 하는 정적 DrawingBrush 또는 VisualBrush 회전 3D 개체 표면에 매핑되어 있습니다. 정적 콘텐츠를 다시 렌더링 성능에 부정적인 영향을 줄이 있습니다.

브러시의 CachingHint 연결된 속성을 로 설정하면 타일식 브러시 Cache개체의 캐시된 버전을 사용하여 성능을 높일 수 있습니다.

CacheInvalidationThresholdMaximum 속성 값은 CacheInvalidationThresholdMinimum 크기가 변경되어 개체를 TileBrush 다시 생성해야 하는 시기를 결정하는 상대 크기 값입니다. 예를 들어 속성이 CacheInvalidationThresholdMaximum 2.0으로 설정된 경우 해당 크기가 현재 캐시 크기의 2배를 초과하는 경우에만 에 대한 TileBrush 캐시를 다시 생성해야 합니다.

코드에서 연결된 속성을 설정 CachingHint 하려면 이 메서드를 사용합니다.

적용 대상

추가 정보