Version

DoubleClickHeader Event

Occurs when a header is double-clicked.
Syntax
'Declaration
 
Public Event DoubleClickHeader As DoubleClickHeaderEventHandler
public event DoubleClickHeaderEventHandler DoubleClickHeader
Event Data

The event handler receives an argument of type DoubleClickHeaderEventArgs containing data related to this event. The following DoubleClickHeaderEventArgs properties provide information specific to this event.

PropertyDescription
Header (Inherited from Infragistics.Win.UltraWinGrid.HeaderEventArgs)Returns the header.
Remarks

Example
This snippet demonstrates how the DoubleClickHeader event can be used. In this example, when the user double-clicks on the header of the "lname" column, a comma-separated list of all the last names in that column is copied to the Windows clipboard.

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.

Private Sub ultraGrid1_DoubleClickHeader(sender As Object, e As Infragistics.Win.UltraWinGrid.DoubleClickHeaderEventArgs) Handles Me.ultraGrid1.DoubleClickHeader
   ' If the user double-clicked on the "lname" column in the "customers" band
   ' then copy a comma-separated list of all the last names in that column to
   ' the Windows clipboard.
   '
   If e.Header.Band.Key = "customers" And e.Header.Column.Key = "lname" Then

      ' If there are no rows then there is nothing to do.
      '
      If Me.ultraGrid1.Rows.Count = 0 Then
         Return
      End If

      ' Create a StringBuilder with roughly the initial capactity to hold all the last names.
      '
      Dim sb As New System.Text.StringBuilder(Me.ultraGrid1.Rows.Count * 8)
      
      ' Loop over all the rows in the first band and append each last name
      ' to the comma-separated list of values.
      '
      Dim row As UltraGridRow
      For Each row In  Me.ultraGrid1.Rows
         sb.AppendFormat("{0}, ", row.Cells("lname").Text)
      Next row 
      ' Remove the final comma and space.
      '
      sb.Remove(sb.Length - 2, 2)
      
      ' Put the comma-separated list of last names on the clipboard.
      '
      Clipboard.SetDataObject(sb.ToString(), True)

   End If
End Sub
private void ultraGrid1_DoubleClickHeader(object sender, Infragistics.Win.UltraWinGrid.DoubleClickHeaderEventArgs e)
{
	// If the user double-clicked on the "lname" column in the "customers" band
	// then copy a comma-separated list of all the last names in that column to
	// the Windows clipboard.
	//
	if( e.Header.Band.Key == "customers" && e.Header.Column.Key == "lname" )
	{
		// If there are no rows then there is nothing to do.
		//
		if( this.ultraGrid1.Rows.Count == 0 )
			return;

		// Create a StringBuilder with roughly the initial capactity to hold all the last names.
		//
		System.Text.StringBuilder sb = new System.Text.StringBuilder( this.ultraGrid1.Rows.Count * 8 );

		// Loop over all the rows in the first band and append each last name
		// to the comma-separated list of values.
		//
		foreach( UltraGridRow row in this.ultraGrid1.Rows )
			sb.AppendFormat( "{0}, ", row.Cells["lname"].Text );
		
		// Remove the final comma and space.
		//
		sb.Remove( sb.Length - 2, 2 );

		// Put the comma-separated list of last names on the clipboard.
		//
		Clipboard.SetDataObject( sb.ToString(), true );
	}
}
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