Reputation: 15
I dont have a clue why DataGridRow returns null:
datagrid.ItemsSource = itemsource;
DataGridRow row = (DataGridRow)datagrid.ItemContainerGenerator.ContainerFromItem(itemsource[i]);
Do you have any idea? xd
Upvotes: 0
Views: 685
Reputation: 2868
You're trying to access the container immediately after setting the ItemsSource. The container is an UI element, let the grid complete it's loading and try accessing the container after that. Possibly try at grid loaded event.
Upvotes: 1