I got a user control 'SubForm'
When click a button on the main form, the 'SubForm' will be added and default data will load to the grid
SubForm subform = new SubForm(); grid_SubForm.Children.Add(subform);
subform.Visibility = Visibility.Visible;
subform.LoadDataToGrid();
Then I got error in LoadDataGrid()
This is function in 'SubForm' to load data in Data Grid as default
dataGrid_grid1's source and header information is set dynamically on User Control Loaded function.
(subform.dataGrid_grid1.Items[row] as DataRowView).Row[column] = 1;
'Operation is not valid while ItemCollection has no inner collection. ItemCollection is uninitialized or binding on ItemsControl.ItemSource supplied null for collection.'
Any solution? thanks.