BitmapSource.SetSource(IRandomAccessStream) Method

Definition

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

public:
 virtual void SetSource(IRandomAccessStream ^ streamSource) = SetSource;
void SetSource(IRandomAccessStream const& streamSource);
public void SetSource(IRandomAccessStream streamSource);
function setSource(streamSource)
Public Sub SetSource (streamSource As IRandomAccessStream)

Parameters

streamSource
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.

Applies to

See also