Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight 3
BitmapImage Class

  Switch on low bandwidth view
This page is specific to
Microsoft Silverlight 3

Other versions are also available for the following:
.NET Framework Class Library for Silverlight
BitmapImage Class

Provides the practical object source type for the Image..::.Source and ImageBrush..::.ImageSource properties.

Namespace:  System.Windows.Media.Imaging
Assembly:  System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public NotInheritable Class BitmapImage _
    Inherits BitmapSource
Visual Basic (Usage)
Dim instance As BitmapImage
C#
public sealed class BitmapImage : BitmapSource
XAML Object Element Usage
<BitmapImage .../>

The BitmapImage can be used to reference images in the JPEG and PNG file formats.

If the Image..::.Source property is set to an invalid format, or is specified to a URI that cannot be resolved, then the ImageFailed event is raised.

Silverlight does not support all possible color depths that are included in the PNG specification. The following are the PNG color depths supported in Silverlight:

  • Indexed color: 1-bit, 4-bit, or 8-bit color depth (per channel).

  • Truecolor: 24-bit color depth, or 32-bit color depth (per channel) for truecolor. Alpha is supported in 32-bit but not in 24-bit PNG file formats.

Notably, gray scale (with or without alpha), and 64-bit truecolor, are not supported in Silverlight.

There are two ways to specify the graphics content for a BitmapImage: by URI, or by stream. You can set with either of these, and the behavior is that the last technique used will specify the content.

XAML usage for BitmapImage as an object element is uncommon, because it would only be appropriate for setting a BitmapImage as the object element within a property element usage for setting Image..::.Source. More typically you would use Image and use the URI to set Image..::.Source as an attribute.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker