BitmapSource.SetSource method

Applies to Windows and Windows Phone

Sets the source image for a BitmapSource by accessing a stream. Most callers should use SetSourceAsync instead.

Syntax


public void SetSource(
  IRandomAccessStream streamSource
)

Parameters

streamSource

Type: IRandomAccessStream

The stream source that sets the image source value.

Remarks

Calling SetSource rather than SetSourceAsync has the potential to block the UI thread until the image source file is returned and processed. It is for this reason that we generally recommend calling SetSourceAsync instead of calling SetSource.

In low memory situations (most likely on lower-memory phones), it is possible for an exception to be raised with the message "The image is unrecognized" and an HRESULT of 0x88982F60. While this exception ordinarily indicates bad data, if your app is close to its memory limit then the cause of the exception is likely to be low memory. In that case, we recommend that you free memory and try again.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Media.Imaging
Windows::UI::Xaml::Media::Imaging [C++]

Metadata

Windows.winmd

See also

BitmapSource
SetSourceAsync
UriSource
Processing image files

 

 

Show:
© 2014 Microsoft