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