Version

Description Property (UltraGridRow)

Returns or sets the text that will be displayed as a description.
Syntax
'Declaration
 
Public Overridable Property Description As String
public virtual string Description {get; set;}
Remarks

The Description property determines the text that will be displayed in the AutoPreview area for a row. This property will be read-only if its band's AutoPreviewField property is set to a valid field or column name.

The following sample code enables the row previews in the UltraGrid.InitializeLayout event and sets descriptions of rows in UltraGrid.InitializeRow event.

C#:

            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                // Enable the row previews.
                //
                this.ultraGrid1.DisplayLayout.Bands[0].AutoPreviewEnabled = true;
            }
            
            private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
            {
                Infragistics.Win.UltraWinGrid.UltraGridBand band;
                band = this.ultraGrid1.DisplayLayout.Bands[0];
            
                // Check for the row being from the same band.
                //
                if ( e.Row.Band == band )
                {
                        // Create a custom description that we want shown in the row's
                        // row preview area.
                        //
                        System.Text.StringBuilder description = new System.Text.StringBuilder( );
            
                        description.Append( e.Row.GetCellText( band.Columns["ContactName"] ) );
                        description.Append( "\n" );
                        description.Append( e.Row.GetCellText( band.Columns["City"] ) );
                        description.Append( ", " );
                        description.Append( e.Row.GetCellText( band.Columns["Country"] ) );
            
                        // Set the row's Description to our custom description text.
                        //
                        e.Row.Description = description.ToString( );
                }
            }
            
Example
The following sample code sets row descriptions for row preview area in the InitializeRow event. It assumes there are ContactName, City and Country columns in band 0.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ultraGrid1.InitializeRow

       ' ReInitialize indicates whether the row is being initialized for the first time
       ' or it's being re-initialized.
       If e.ReInitialize Then
           Debug.WriteLine("A row is being re-initilaized.")
       Else
           Debug.WriteLine("A row is being initilaized.")
       End If

       Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0)

       ' Check to see if the row is from band 0.
       '
       If e.Row.Band Is Me.ultraGrid1.DisplayLayout.Bands(0) Then
           ' Create a custom description that we want shown in the row's
           ' row preview area.
           Dim description As System.Text.StringBuilder = New System.Text.StringBuilder()

           description.Append(e.Row.GetCellText(band.Columns("ContactName")))
           description.Append(vbCrLf)
           description.Append(e.Row.GetCellText(band.Columns("City")))
           description.Append(", ")
           description.Append(e.Row.GetCellText(band.Columns("Country")))

           ' Set the row's Description to our custom description text.
           e.Row.Description = description.ToString()
       End If

   End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{

	// ReInitialize indicates whether the row is being initialized for the first time
	// or it's being re-initialized.
	if ( e.ReInitialize )
		Debug.WriteLine( "A row is being re-initilaized." );
	else
		Debug.WriteLine( "A row is being initilaized." );

	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
	 
	// Check to see if the row is from band 0.
	//
	if ( e.Row.Band == this.ultraGrid1.DisplayLayout.Bands[0] )
	{
		// Create a custom description that we want shown in the row's
		// row preview area.
		System.Text.StringBuilder description = new System.Text.StringBuilder( );
	 
		description.Append( e.Row.GetCellText( band.Columns["ContactName"] ) );
		description.Append( "\n" );
		description.Append( e.Row.GetCellText( band.Columns["City"] ) );
		description.Append( ", " );
		description.Append( e.Row.GetCellText( band.Columns["Country"] ) );
	 
		// Set the row's Description to our custom description text.
		e.Row.Description = description.ToString( );
	}

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also