This documentation is archived and is not being maintained.

BitmapDecoder.Create Method (Uri, BitmapCreateOptions, BitmapCacheOption)

Creates a BitmapDecoder from a Uri by using the specified BitmapCreateOptions and BitmapCacheOption.

Namespace: System.Windows.Media.Imaging
Assembly: PresentationCore (in presentationcore.dll)

public static BitmapDecoder Create (
	Uri bitmapUri,
	BitmapCreateOptions createOptions,
	BitmapCacheOption cacheOption
)
public static BitmapDecoder Create (
	Uri bitmapUri, 
	BitmapCreateOptions createOptions, 
	BitmapCacheOption cacheOption
)
public static function Create (
	bitmapUri : Uri, 
	createOptions : BitmapCreateOptions, 
	cacheOption : BitmapCacheOption
) : BitmapDecoder
You cannot use methods in XAML.

Parameters

bitmapUri

The Uri of the bitmap to decode.

createOptions

Identifies the BitmapCreateOptions for this decoder.

cacheOption

Identifies the BitmapCacheOption for this decoder.

Return Value

A new BitmapDecoder.

Exception typeCondition

ArgumentNullException

The bitmapUri is a null reference (Nothing in Visual Basic).

FileFormatException

The bitmapUri specifies a class ID of an unsupported format type.

The following example demonstrates how to use the Create(Uri,BitmapCreateOptions,BitmapCacheOption) method to create a decoder for a given image. The first BitmapFrame of the image is used as the source of an Image control.

BitmapDecoder uriBitmap = BitmapDecoder.Create(
   new Uri("sampleImages/waterlilies.jpg", UriKind.Relative),
   BitmapCreateOptions.None,
   BitmapCacheOption.Default);

// Create an image element;
Image uriImage = new Image();
uriImage.Width = 200;
// Set image source.
uriImage.Source = uriBitmap.Frames[0];

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: