Hi, I'm storing the urls to the images in a sql ce 3.5 database as strings. I want to retrieve the urls and display them in the main application window. Here is the code:
DataSet myDataSet;
private void OnInit(object sender, EventArgs e)
{
string connString = Properties.Settings.Default.SystemicsAnalystDBConnectionString;
OleDbConnection conn = new OleDbConnection(connString);
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT url FROM Library;", conn);
myDataSet = new DataSet();
adapter.Fill(myDataSet, "Library");
myListBox.DataContext = myDataSet;
}
The first problem is that I don't think the method onInit is fired. But I don't know the reason for that.
The second problem is with XAML file. I need a container for images (like the listbox for textboxes) and since I won't know how many images are there I need some kind of a template:
<DataTemplate>
<StackPanel>
<Image Source="{Binding Path=url}" />
</StackPanel>
</DataTemplate>
But there has to be some kind of a container that would have the datacontext set to the data source.
Could anyone help?