DataGrid.IsExpanded(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得值,表示指定資料列的節點是展開還是摺疊。
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