Losing Datagrid Content when Adding TableStyle
I have an issue with a datagrid 'losing' it's contents when I add a tablestyle to it.
I have one simple line:
MyDataGrid.TableStyles.Add(MyTableStyle)
When run in debug and put a break point on this line, I can see the contents of the datagrid, i.e. MyDataGrid (0,0) returns a value.
However as soon as I run this line and try doing the MyDataGrid(0,0) again I get the following error:
Run-time exception thrown : System.ArgumentOutOfRangeException - Specified argument was out of the range of valid values.
Parameter name: rowIndex
Has anyone else had this problem?
Any ideas what is going on?
|