DataGrid.IsExpanded(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that indicates whether the node of a specified row is expanded or collapsed.
public:
bool IsExpanded(int rowNumber);
public bool IsExpanded (int rowNumber);
member this.IsExpanded : int -> bool
Public Function IsExpanded (rowNumber As Integer) As Boolean
Parameters
- rowNumber
- Int32
The number of the row in question.
Returns
true
if the node is expanded; otherwise, false
.
Examples
The following code example tests each row in the grid, and prints the row number of expanded rows.
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
Applies to
See also
ทํางานร่วมกับเราใน GitHub
แหล่งที่มาสำหรับเนื้อหานี้สามารถพบได้บน GitHub ซึ่งคุณยังสามารถสร้างและตรวจสอบปัญหาและคำขอดึงข้อมูลได้ สำหรับข้อมูลเพิ่มเติม ให้ดูคู่มือผู้สนับสนุนของเรา