- The
BitmapImageclass is a non-abstractsubclass ofBitmapSource, so just use theBitmapImage(Uri)constructor and pass that new instance to anything that expects aBitmapSourceobject. - Don’t be confused by the fact the argument type is
System.Uri: aUriisn’t just forhttp://addresses, but it’s also suitable for local filesystem paths and UNC shares, and more.
So this works for me:
BitmapImage thisIsABitmapImage = new BitmapImage(new Uri("c:\\image.bmp"));
BitmapSource thisIsABitmapImageUpcastToBitmapSource = thisIsABitmapImage;