This project has moved. For the latest updates, please go here.

Datagrid GetContainerFromItem returns null

Jun 23, 2014 at 5:56 PM
I'm calling GetContainerFromItem, but for some reason, it's returning null. The item is in view and should have a valid container. However, when I was debugging this, I threw a test MessageBox.Show() just prior to the GetContainerFromItem call, and that allowed the function to return proper results, but as soon as I take out the MessageBox, the call fails again.

What could cause this sort of behaviour? Does the MessageBox trigger something from the datagrid that would allow the call to go through properly? GetContainerFromIndex also gives similar results.
Jul 3, 2014 at 9:59 PM
I figured it out, somewhere in my code, I was doing an Items.Refresh and an InvalidateVisual.