Creates and caches a bitmap representation of a UIElement.
Assembly: PresentationCore (in PresentationCore.dll)
Gets a value that indicates whether the object can be made unmodifiable. (Inherited from Freezable.)
Gets or sets a value that indicates whether the bitmap is rendered with ClearType activated.
Gets a value that indicates whether the object is currently modifiable. (Inherited from Freezable.)
Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)
Gets or sets a value that indicates the scale that is applied to the bitmap.
Gets or sets a value that indicates whether the bitmap is rendered with pixel snapping.
Use the UIElement. Create a and assign it to the CacheMode property of a UIElement to cache the element and its subtree as a bitmap in video memory. This is useful when you need to animate, translate, or scale a UIElement as quickly as possible. This approach enables a tradeoff between performance and visual quality while content is cached.class to improve rendering performance of a complex
Use the BitmapCacheBrush class to efficiently reuse a cached element.
Set the RenderAtScale property to scale the bitmap cache. This is useful if an element will be zoomed, and you want the element to render more clearly than it would if the cache were simply generated at the element’s native resolution.
Set the SnapsToDevicePixels property when the cache displays content that requires pixel-alignment to render correctly, such as ClearType text. This property is ignored by the BitmapCacheBrush and Viewport2DVisual3D classes.
Caching a control does not affect mouse-over behavior, so mouse-over hit testing operates as if it the bitmap were a live control.
Cache regeneration occurs only when the structure of the UIElement or its subtree changes, or when the CacheMode settings change. Setting the RenderAtScale or EnableClearType properties causes cache regeneration. Changes to the parent visual tree of the cached UIElement, such as transforms, scales, opacities, and effects, do not affect the cache.
The cache functions when hardware acceleration is not available. In this case, the bitmap is rendered in software, and the maximum bitmap dimensions are 2048 x 2048.
The following XAML shows how to cache a Canvas element. For the complete code example, see How to: Improve Rendering Performance by Caching an Element.
<!-- //////////////////////////////////////////////////////////////// --> <!-- // The following XAML creates a BitmapCache with default // --> <!-- // properties and assigns it as the CacheMode for the canvas. // --> <!-- //////////////////////////////////////////////////////////////// --> <Canvas.CacheMode> <BitmapCache EnableClearType="False" RenderAtScale="1" SnapsToDevicePixels="False" /> </Canvas.CacheMode>
Available since 4.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.