i try to show images from database in datagrid that i saved them as binary. pictures are showed but im getting binding errors. my datagrid xaml codes are:
<DataGridTemplateColumn Header=" Image" Width=" 95">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Image Source="{Binding ProductImage ,TargetNullValue={x:Null}}" Width=" 80" Height=" 80"></Image>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.HeaderStyle >
<Style TargetType="{x:Type DataGridColumnHeader }">
<Setter Property="FontFamily" Value="Arial Black"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FF3211B8" />
<Setter Property="FontSize" Value="12"/>
</Style>
</DataGridTemplateColumn.HeaderStyle>
</DataGridTemplateColumn>
and the c# code that im using to convert images to binary and save them to database
FileStream fileStream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
byte[] ImgByteArr = new byte[fileStream.Length];
fileStream.Read(ImgByteArr, 0, ImgByteArr.Length);
fileStream.Close();
and i send (ImgByteArr) to database
when i scroll up and down, number of binding errors are increasing. also image can be null.