DataGrid.IsExpanded(Int32) Method

Definition

Gets a value that indicates whether the node of a specified row is expanded or collapsed.

C#
public bool IsExpanded(int rowNumber);

Parameters

rowNumber
Int32

The number of the row in question.

Returns

true if the node is expanded; otherwise, false.

Examples

The following code example tests each row in the grid, and prints the row number of expanded rows.

C#
protected void TextExpanded(DataGrid myGrid){
    // Get the DataTable of the grid
    DataTable myTable;
    // Assuming the grid is bound to a DataTable
    myTable = (DataTable) myGrid.DataSource;
    for(int i = 0;i < myTable.Rows.Count ;i++) {
       if(myGrid.IsExpanded(i)) {
          Console.WriteLine("Row " + i + " was expanded");
       }
    }
 }

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0

See also