I have looked at the similar questions to this on here, but could not find one that fit my error (that worked). My code is:
public MainWindow()
{
InitializeComponent();
}
public List<item> loadedCategory = new List<item>();
private void Open_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
{
List<item> loadedCategory = loaders.category_loader(openFileDialog.FileName);
}
left_panel_lower_list.ItemsSource = loadedCategory;
}
the item object is just a DTO that holds 4 properties. loaders.category_loader returns a list of items. The error is marked at the end of the ItemSource assignment line. I have tried moving the assignment line to most other places in the code, and it never runs.
What am I doing wrong?