I have a listbox displaying gifs (pulled from a database).
I would like to be able to store the listbox's contents into an array. I tried assigning the source to an array, but I'm getting the error that cannot implicitly convert type System.Data.DataView to the array.
How can I solve this?
privatevoidBtn_Click(object sender,RoutedEventArgs e){SQLiteConnection sqliteCon =newSQLiteConnection(dbConnectionString); sqliteCon.Open();stringSelectionQuery="SELECT gif FROM myTable WHERE Style = 'Jump'";SQLiteDataAdapter adapter =newSQLiteDataAdapter(SelectionQuery, sqliteCon);DataTable dt =newDataTable(); adapter.Fill(dt);DataView source = myListBox.ItemsSourceasDataView;foreach(DataRow dr in dt.Rows){ source.Table.ImportRow(dr);} myListBox.ItemsSource=null; myListBox.ItemsSource= source;}