DataGrid.IsExpanded(Int32) Metodo

Definizione

Ottiene un valore che indica se il nodo di una riga specificata è espanso o compresso.

public:
 bool IsExpanded(int rowNumber);
public bool IsExpanded (int rowNumber);
member this.IsExpanded : int -> bool
Public Function IsExpanded (rowNumber As Integer) As Boolean

Parametri

rowNumber
Int32

Numero della riga in questione.

Restituisce

true se il nodo è espanso; in caso contrario, false.

Esempio

Nell'esempio di codice seguente viene verificata ogni riga della griglia e viene stampato il numero di righe espanse.

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 {0} was expanded", i );
         }
      }
   }
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");
       }
    }
 }
Protected Sub TextExpanded(myGrid As DataGrid)
    ' Get the DataTable of the grid
    Dim myTable As DataTable
    ' Assuming the grid is bound to a DataTable
    myTable = CType(myGrid.DataSource, DataTable)
    Dim i As Integer
    For i = 0 To myTable.Rows.Count - 1
        If myGrid.IsExpanded(i) Then
            Console.WriteLine(("Row " & i & " was expanded"))
        End If
    Next i
End Sub

Si applica a

Vedi anche