Source. Set Source(IRandomAccessStream) Method
Equivalent WinUI method: Microsoft.UI.Xaml.Media.Imaging.BitmapSource.SetSource.
public: virtual void SetSource(IRandomAccessStream ^ streamSource) = SetSource;
void SetSource(IRandomAccessStream const & streamSource);
public void SetSource(IRandomAccessStream streamSource);
Public Sub SetSource (streamSource As IRandomAccessStream)
The stream source that sets the image source value.
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.