The grid may work in row focusing mode or in cell focusing mode. A focused cell is an intersection of a focused row and a column. You can use Cell.Focused property to enable focusing as shown in the example below.

C# Copy imageCopy
public void FocusedCellExample(Grid grid)
    //Add a new header on the top hierarchical level (level 0)
    Header header = new Header();
    header.Add(new Column("Name"));
    header.Add(new Column("Price"));
    header.Add(new Column("Quantity"));

    //Set the focus mode
    grid.FocusSettings.Mode = FocusMode.Cell;

    //Add some data objects 
    grid.Rows.Add(new Product());
    grid.Rows.Add(new Product());

    //Focus the cell
    grid.Rows[0]["Price"].Focused = true;

    Console.WriteLine("Focused row = {0}", grid.FocusedRow.VisibleChildIndex);
    Console.WriteLine("Focused column = {0}", grid.Headers[0].FocusedColumn.Id);

    //Focus other column
    grid.Headers[0]["Quantity"].Focused = true;

    Console.WriteLine("The cell[0, 'Quantity'] is {0}", grid.Rows[0]["Quantity"].Focused ? "focused" : "not focused");

//Focused row = 0
//Focused column = Price
//The cell[0, 'Quantity'] is focused

Back to .Net Grid HowTo topics