Gets or sets a value indicating whether this Cell is focused.

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
public bool Focused { get; set; }
Visual Basic
Public Property Focused As Boolean
	Get
	Set
Visual C++
public:
property bool Focused {
	bool get ();
	void set (bool value);
}
F#
member Focused : bool with get, set

Property Value

Type: Boolean
true if focused; otherwise, false.

Remarks

The Cell can be focused only if grid focus mode is set to Cell.

Examples

 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"));
    grid.Headers.Add(header);

    //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");
}

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

See Also