Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UIElement.CacheMode Property

Gets or sets a value that indicates that rendered content should be cached when possible.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public CacheMode CacheMode { get; set; }
<uiElement>
  <uiElement.CacheMode>
    singleBitmapCache
  </uiElement.CacheMode>
</uiElement>

XAML Values

singleBitmapCache

Exactly one BitmapCache object element, generally with the RenderAtScale attribute set. Technically, the XAML accepts any CacheMode object value, but BitmapCache is the only existing practical derived class in the Silverlight core API.

Property Value

Type: System.Windows.Media.CacheMode
A value that indicates that rendered content should be cached when possible. If you specify a value of CacheMode, rendering operations from RenderTransform and Opacity execute on the graphics processing unit (GPU), if available. The default is null, which does not enable a cached composition mode.

Dependency property identifier field: CacheModeProperty

In order to enable caching, you must enable composition caching at the plug-in level by setting the value of an EnableGPUAcceleration param element to true as part of the object tag that declares the Silverlight plug-in.

To use GPU hardware acceleration in Silverlight effectively, you should understand how Silverlight uses hardware acceleration and cached composition in its architecture, and which Silverlight objects and rendering scenarios can benefit under hardware acceleration. For more information, see Silverlight Hardware Acceleration.

You can profile hardware acceleration optimizations in the development phase of your application; see EnableCacheVisualization (Silverlight Plug-in Object).

The XAML usage shown is the only practical available usage in Silverlight core libraries. In theory, other CacheMode classes could be written to fill the CacheMode value, but these would be custom classes. See BitmapCache for the attributes you might set on the BitmapCache object element value.

NoteNote:

Out-of-browser applications do not have editable hosting HTML. To enable GPU acceleration for an out-of-browser application, set the attribute EnableGPUAcceleration to true on the OutOfBrowserSettings element that you declare in your Deployment XAML file.

Version Notes

Silverlight for Windows Phone Silverlight for Windows Phone

Silverlight for Windows Phone has a different set of operations that can use GPU acceleration; for more information, see Graphics in Silverlight for Windows Phone.

Before you can use the CacheMode property, you need to enable GPU acceleration at the plug-in level (in the HTML) by setting the EnableGPUAcceleration parameter to true.

<param name="EnableGPUAcceleration" value="true" />

The following XAML uses a BitmapCache to set CacheMode for a MediaElement.

<MediaElement>
  <MediaElement.CacheMode>
    <BitmapCache RenderAtScale="4"/>
  </ MediaElement.CacheMode>
</MediaElement>

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2014 Microsoft