Hello,
I will set the active cell with following program code:
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { dg.Rows[0].Cells[1].IsActive = true; }
And I become a NullReferenceException. With the debugger I can see this cell with data.
Following program code with another row works correct:
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { dg.Rows[1].Cells[0].IsActive = true; }
Can you help me, please.
Hi Thomas,
I'm not sure. This shouldn't be happening.
Do you have a sample you can attach to this thread, so I can look into this further?
-SteveZ
Hi SteveZ,
it's the same problem.
I've a grid with 2 rows and 2 columns and I can't set a cell active in the 2nd column.
When I use a debugger and bevor run the error code line I can see the 2nd column in the debugger. The property "IsActive" is false. I run the code line, I become a NullReferenceException and the debugger show me a changed property "IsActive=true". Why ?
Thomas
Hi,
I'd recommend using the Key of your column to make sure you're targeting the correct column.
dg.Rows[0].Cells["MyColumn"].IsActive = true;
I noticed that your second line of code, uses a different cell, which could mean that maybe Cells[1] is a hidden column, or maybe you only have one column. It's always safer to use the Column keys, as it ensure you're working with the column you intended.
Hope this helps,