As you tabbed to the right side of your grid, you have to tabbed through these zero width column and that is causing the tab key to appear not to work properly. One solution is to handle the grid’s CurrentCellChanged event, and if you are on a border cell (among the hidden columns), then explicitly set the proper currentcell.
//columns 3-6 are hidden with 0-column width...
private int LEFTHIDDENCOLUMN = 3;
private int RIGHTHIDDENCOLUMN = 6;
private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
{
if(dataGrid1.CurrentCell.ColumnNumber == LEFTHIDDENCOLUMN)
dataGrid1.CurrentCell = new DataGridCell(dataGrid1.CurrentCell.RowNumber + 1, 0);
else if(dataGrid1.CurrentCell.ColumnNumber == RIGHTHIDDENCOLUMN)
dataGrid1.CurrentCell = new DataGridCell(dataGrid1.CurrentCell.RowNumber, LEFTHIDDENCOLUMN - 1);
}
Share with