Click here to Skip to main content
15,867,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My datasource for this app is a Sqlite DB. It all works pretty fine except of one point.

I want to fill an item grid with data from that DB and use the pictures stored in that db as background images.

C#
public class Movie_Picture
      {
          [SQLite.AutoIncrement, SQLite.PrimaryKey]
          public int id { get; set; }
          public byte[] Picture { get; set; }
          public int Movie_id { get; set; }

      }


If I query this table with

C#
var query = connection.QueryAsync<Movie_Picture>("Select * from Movie_Picture");


i can fill the item grid and each item in that grid gets his label from Movie_id and id but the images aren´t displayed

The XAML for this grid looks like
C#
<GridView x:Name="DataGrid1" SelectionChanged="DataGrid1_SelectionChanged" ItemsSource="{Binding}">
  <GridView.ItemTemplate>
     <DataTemplate>
      <Grid  Width="300" Height="300" removed="{x:Null}">
       <TextBlock Text="{Binding id}" Margin="0,140,0,0"></TextBlock>
       <TextBlock Text="{Binding Movie_id}" Margin="0,180,0,0"></TextBlock>
       <Image x:Name="itemImage" Source="{Binding Picture, Converter={StaticResource    BytesToImageConverter}}" />
      </Grid>
     </DataTemplate>
    </GridView.ItemTemplate>
 </GridView>


Any help would be appriciated.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900