public GridCell GetNeighborGrid(CellNeighbor nb)
{
switch (nb)
{
case CellNeighbor.Left:
{
GridColumn prevColumn = column.PrevColumn;
if (prevColumn != null)
{
return prevColumn.GetCell(row.RowIndex);
}
else
{
return null;
}
}
case CellNeighbor.Right:
{
GridColumn nextColumn = column.NextColumn;
if (nextColumn != null)
{
return nextColumn.GetCell(row.RowIndex);
}
else
{
return null;
}
}
case CellNeighbor.Up:
{
if (row.RowIndex > 0)
{
return column.GetCell(row.RowIndex - 1);
}
else
{
return null;
}
}
case CellNeighbor.Down:
{
if (row.RowIndex < row.OwnerGridRowCount - 1)
{
return column.GetCell(row.RowIndex + 1);
}
else
{
return null;
}
}
default:
{
#if DEBUG
throw new NotSupportedException();
#else
return null;
#endif
}
}
}