Infragistics(R) NetAdvantage(R) Windows Forms
Expanded Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridRow Class : Expanded Property

Returns or sets whether the row is expanded. This property is not available at design-time.

Syntax

Visual Basic (Declaration) 
Public Property Expanded As Boolean
C# 
public bool Expanded {get; set;}

Example

Following code toggles a row's Expanded status.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Button54_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button54.Click

       Dim row As UltraGridRow = Me.UltraGrid1.Rows(0)

       ' Check to see if the row is expandable which depends on factors like whether
       ' the row has any child rows and whether the band associated with it is expandable.
       ' Return if the row is not expandable
       If Not row.IsExpandable Then
           Return
       End If

       ' Toggle the row's expanded status.
       If Not row.Expanded Then
           ' Set the Expanded to true to expand the row.
           row.Expanded = True
       Else
           ' Set the Expanded to false to collapse the row.
           row.Expanded = False
       End If

       ' IsExpanded property indicates whether the row is actually expanded. For example, If you
       ' were to set Expanded to true on a row that wasn't expandable (ie IsExpandable returned
       ' false), Expanded property would return true even thought the row wasn't actually expanded.
       ' However IsExpanded would rerturn false indicating the true status of the row's expansion
       ' status.
       Debug.WriteLine("Is row actually expanded ? " & row.IsExpanded)

   End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button54_Click(object sender, System.EventArgs e)
{

	UltraGridRow row = this.ultraGrid1.Rows[0];

	// Check to see if the row is expandable which depends on factors like whether
	// the row has any child rows and whether the band associated with it is expandable.
	// Return if the row is not expandable
	if ( !row.IsExpandable )				
		return;

	// Toggle the row's expanded status.
	if ( !row.Expanded )
	{
		// Set the Expanded to true to expand the row.
		row.Expanded = true;
	}
	else
	{
		// Set the Expanded to false to collapse the row.
		row.Expanded = false;
	}

	// IsExpanded property indicates whether the row is actually expanded. For example, If you
	// were to set Expanded to true on a row that wasn't expandable (ie IsExpandable returned
	// false), Expanded property would return true even thought the row wasn't actually expanded.
	// However IsExpanded would rerturn false indicating the true status of the row's expansion
	// status.
	Debug.WriteLine( "Is row actually expanded ? " + row.IsExpanded );

}

Remarks

If set to False, the row will be collapsed but child row expand/collapse information will not be discarded. An error occurs if this property is set to True and the Expandable property of the UltraGridBand object is False.

To expand or collapse all the rows of a grid or a specific row collection use the RowsCollection's Infragistics.Win.UltraWinGrid.RowsCollection.ExpandAll and Infragistics.Win.UltraWinGrid.RowsCollection.CollapseAll methods.

See Also