Just started working with WPF and I am trying to work with the data grid and ObservableCollection with binding the data between them and I got a few questions about that subject:
I did a binding to the ItemsSource on the XAML file to the cs ObservableCollection property and when I did it through the XAML I didn't see any data displayed in the DataGrid but when I did this:
mainWindow_myDataGrid.ItemsSource = dbData
(mainWindow_myDataGrid is the XAML DataGrid , dbData is ObservableCollection property) it worked and I don't have a clue why.
- When I did the binding through the code
(mainWindow_myDataGrid.ItemsSource = dbData). I didn't use theDataGridTextColumnview in the XAML file and I saw the data in it. But when I did used it, it crashed with an error that says
"error when adding a row",
then again I have no clue why.
I firstly tried to find answers on my self of course with no success. If anyone could clear those points to me that would be great!