this is my xaml
<Window.Resources>
<DataTemplate x:Key="listBoxTemplate">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding thumb}" Height="100" Width="130" Margin="5"></Image>
<StackPanel Orientation="Vertical" Width="247">
<TextBlock Text="{Binding recipeName}" Height="60" Padding="15" FontSize="16" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding cuisine}" Height="60" Padding="15" FontSize="16" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</StackPanel>
</DataTemplate>
</Window.Resources>
and my code:
conn = new SQLiteConnection(connString);
cmd = new SQLiteCommand();
dtSet = new DataSet();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT id,recipeName,cuisine,thumb FROM RECIPES";
dataAdapter = new SQLiteDataAdapter();
dataAdapter.SelectCommand = cmd;
try{
dataAdapter.Fill(dtSet,"recipes");
listBox1.DataContext = dtSet;
}
the problem is the image doesn't appear. let's say the thumb returned from sqlite is the image file name 1.jpg, 2.jpg and so on.. so where do I put the images to make it appear in the program? in which folder?
i'm having the exact problem with WPF Image Source binding with StringFormat and https://stackoverflow.com/questions/3717968/button-image-source-binding-using-string-format-in-wpf and the answers are I need to make some kind of converter that will convert the image path into bitmap source.. but being a noob I don't really know how to do it.