Version

BeforeCellListDropDown Event

Occurs before a cell's dropdown list is dropped down in a column using one of the dropdown list styles.
Syntax
'Declaration
 
Public Event BeforeCellListDropDown As CancelableCellEventHandler
public event CancelableCellEventHandler BeforeCellListDropDown
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Cell Returns a reference to the cell of interest.
Remarks

The cell argument returns a reference to an UltraGridCell object that can be used to set properties of, and invoke methods on, the cell that will have its dropdown list dropped down. You can use this reference to access any of the returned cell's properties or methods.

The cancel argument enables you to programmatically prevent the cell's dropdown list from being dropped down. This argument can be used to prevent the dropdown list from dropping down unless a certain condition is met.

This event is generated when a cell's dropdown list is about to be dropped down, either programmatically, or by user interaction. A cell's dropdown list can be dropped down programmatically by setting the cell's DroppedDown property to True.

This event is only generated for a cell whose column's Style property is set to 4 (StyleDropDown), 5 (StyleDropDownList), 6 (StyleDropDownValidate), or 8 (StyleDropDownCalendar).

Set the column's ValueList property to a ValueList object to populate the dropdown list.

The AfterCellListCloseUp event is generated when a cell's dropdown list is closed.

Example
Following code illustrates an usage of BeforeCellListDropDown event.

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 UltraGrid1_BeforeCellListDropDown(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableCellEventArgs) Handles ultraGrid1.BeforeCellListDropDown

      ' BeforeCellListDropDown gets fired when the user is dropping down the drop down
      ' in a cell, for example by clicking on the drop down arrow in the cell.
      ' Following code cancels the event preventing the UltraGrid from dropping the
      ' drop-down down if the number of items in the value list is 0.

      If Not Nothing Is e.Cell.Column.ValueList AndAlso e.Cell.Column.ValueList.ItemCount <= 0 Then
          e.Cancel = True
      End If

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

private void ultraGrid1_BeforeCellListDropDown(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
{

	// BeforeCellListDropDown gets fired when the user is dropping down the drop down
	// in a cell, for example by clicking on the drop down arrow in the cell.
	// Following code cancels the event preventing the UltraGrid from dropping the
	// drop-down down if the number of items in the value list is 0.

	if ( null != e.Cell.Column.ValueList && e.Cell.Column.ValueList.ItemCount <= 0 )
	{
		e.Cancel = 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