We are trying to Display an image in one cell of our grid from an image loaded from a database. The data access layer is returning the image column as a byte array. The image type is png in the db. Does someone have a sample of the xaml and the convertor code to do this?
Can someone help with this?
Use sample from Infragistics help: Displaying an Image in a Field and add this:
1. in XAML
xmlns:local="clr-namespace:yourapplicationnamespace"
<Grid.Resources>
<local:ImageConverter x:Key="ImageConverter" />
...
<igDP:Field Name="photo" Converter="{StaticResource ImageConverter}" >
2. in Code behavior:
public class ImageConverter : IValueConverter
{
MemoryStream str = new MemoryStream(((byte[)value));
img.BeginInit();
img.StreamSource = str;
img.EndInit();
}
Have you looked at the PngBitmapDecoder Class?
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.pngbitmapdecoder.aspx
What about if the image is png format? All of our images are in that format.