I have a DataGrid
and I want the user to be able to show/hide columns on it.
I have a button that will show/hide a specific column, and it works fine on one (fast, graphics card, .NET 4.5) machine but not on a different (slow, no graphics hardware, .NET 4.0) machine.
The InvalidOperationException
is thrown when hiding then showing the same column... Note that multiple columns can be turned off (by setting their Visiblity
to Collapsed
), but as soon as one that is already off is turned back on (setting Visibility
to Visible
) the application crashes and throws the exception.
Looking at the Event Viewer, the exception is being thrown in the DataGrid
's AddLogicalChild
method, which calls ChangeLogicalParent
(I'm assuming on the column being added- note I cannot debug this with breakpoints as the machine I am running it on does not have Visual Studio installed)
Any ideas on what could be causing the app to throw the exception on one machine but not another? Any chance that the .NET runtime has anything to do with it? (upgrading to .NET 4.5 on the machine running the app may not be feasible)