DataGrid.IsExpanded(Int32) メソッド

定義

指定した行のノードを展開するか、折りたたむかを示す値を取得します。

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

パラメーター

rowNumber
Int32

該当する行の番号。

戻り値

ノードを展開する場合は true。それ以外の場合は false

次のコード例では、グリッド内の各行をテストし、展開された行の行番号を出力します。

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

適用対象

こちらもご覧ください