How do I bind a Byte array to an Image in WPF with a value converter?

后端 未结 5 1335
逝去的感伤
逝去的感伤 2020-12-03 05:59

I\'m trying to bind a Byte array from my databse to a WPF Image.

My XAML:


    

        
5条回答
  •  一向
    一向 (楼主)
    2020-12-03 06:18

    Try using this

    Dim imageSource as ImageSource
    Dim bitmapDecoder = new PngBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
    imageSource = bitmapDecoder.Frames[0];
    imageSource.Freeze();
    Return imageSource
    

提交回复
热议问题