次の方法で共有


DataGrid.IsExpanded メソッド

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

Public Function IsExpanded( _
   ByVal rowNumber As Integer _) As Boolean
[C#]
public bool IsExpanded(introwNumber);
[C++]
public: bool IsExpanded(introwNumber);
[JScript]
public function IsExpanded(
   rowNumber : int) : Boolean;

パラメータ

  • rowNumber
    該当する行の番号。

戻り値

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

使用例

[Visual Basic, C#, C++] グリッド内の各行をテストし、展開されている行の行番号を出力する例を次に示します。

 
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 'TextExpanded

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

[C++] 
protected:
void TextExpanded(DataGrid* myGrid){
    // Get the DataTable of the grid
    DataTable* myTable;
    // Assuming the grid is bound to a DataTable
    myTable = dynamic_cast<DataTable*> (myGrid->DataSource);
    for(int i = 0;i < myTable->Rows->Count ;i++) {
       if(myGrid->IsExpanded(i)) {
          Console::WriteLine(S"Row {0} was expanded", __box(i));
       }
    }
 }
    

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

DataGrid クラス | DataGrid メンバ | System.Windows.Forms 名前空間 | Collapse