wpfimagec#-4.0interopbitmapimage

WPF: Image Source is System.Windows.Interop.InteropBitmap


How to set the Source of System.Windows.Controls.Image if the Source is a type of System.Windows.Interop.InteropBitmap? InteropBitmap info below:

{System.Windows.Interop.InteropBitmap}
[System.Windows.Interop.InteropBitmap]: {System.Windows.Interop.InteropBitmap}
base {System.Windows.Media.ImageSource}: {System.Windows.Interop.InteropBitmap}
DpiX: 96.0
DpiY: 96.0
Format: {Bgra32}
Height: 851.0
IsDownloading: false
Metadata: null
Palette: null
PixelHeight: 851
PixelWidth: 900
Width: 900.0

Thank you


Solution

  • It looks like InteropBitmap inherits from ImageSource already. You should be able to do myImage.Source = myInteropbitmap; ?

    Ref:

    http://msdn.microsoft.com/en-us/library/system.windows.interop.interopbitmap.aspx

    InteropBitmap to BitmapImage

    http://msdn.microsoft.com/en-us/library/system.windows.controls.image.source.aspx