Version

OnBeforeDropDown Method (UltraDropDown)

Called before the list is dropped down
Syntax
'Declaration
 
Protected Overridable Sub OnBeforeDropDown( _
   ByVal e As CancelableDropDownEventArgs _
) 
protected virtual void OnBeforeDropDown( 
   CancelableDropDownEventArgs e
)

Parameters

e
Example
Following code shows how one can use BeforeDropDown event of the UltraDropDown to syncronize the appearance of the drop-down to the appearance of the cell it's being dropped down in.

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

  Private Sub UltraDropDown1_BeforeDropDown(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ultraDropDown1.BeforeDropDown

      ' BeforeDropDown gets fired right before the drop down is about to drop down.
      ' This event also gives you a chance to prevent it from dropping down
      ' by setting Cancel property off the passed in event args to false.
      ' Following code sets the appearnace of rows in the UltraDropDown to the
      ' appearance of the cell in the UltraGrid that the UltraDropDown is being 
      ' dropped down in.

      If Not Nothing Is Me.ultraGrid1.ActiveCell AndAlso _
         Me.ultraGrid1.ActiveCell.IsInEditMode AndAlso _
         Me.ultraGrid1.ActiveCell.Column.ValueList Is Me.ultraDropDown1 Then

          ' Get the appearance of the cell in the UltraGrid that's in edit mode.
          Dim appData As AppearanceData = New AppearanceData()
          Me.ultraGrid1.ActiveCell.ResolveAppearance(appData)

          ' Set the appearance of rows in the UltraDropDown to that appearance.
          Me.ultraDropDown1.DisplayLayout.Override.RowAppearance = New Infragistics.Win.Appearance(appData)
      End If

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

private void ultraDropDown1_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs e)
{

	// BeforeDropDown gets fired right before the drop down is about to drop down.
	// This event also gives you a chance to prevent it from dropping down
	// by setting Cancel property off the passed in event args to false.
	// Following code sets the appearnace of rows in the UltraDropDown to the
	// appearance of the cell in the UltraGrid that the UltraDropDown is being 
	// dropped down in.

	if ( null != this.ultraGrid1.ActiveCell && this.ultraGrid1.ActiveCell.IsInEditMode &&
		this.ultraGrid1.ActiveCell.Column.ValueList == this.ultraDropDown1 )
	{
		// Get the appearance of the cell in the UltraGrid that's in edit mode.
		AppearanceData appData = new AppearanceData( );
		this.ultraGrid1.ActiveCell.ResolveAppearance( ref appData );

		// Set the appearance of rows in the UltraDropDown to that appearance.
		this.ultraDropDown1.DisplayLayout.Override.RowAppearance =
										new Infragistics.Win.Appearance( ref appData );
	}

}
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