Version

InitializeLayout Event (UltraDropDown)

Occurs when the display layout is initialized, such as when the control is loading data from the data source.
Syntax
'Declaration
 
Public Event InitializeLayout As InitializeLayoutEventHandler
public event InitializeLayoutEventHandler InitializeLayout
Event Data

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

PropertyDescription
Layout UltraGridLayout
Remarks

The InitializeLayoutEventArgs.Layout argument returns a reference to a UltraGridBase.DisplayLayout object that can be used to set properties of, and invoke methods on, the layout of the control. You can use this reference to access any of the returned layout's properties or methods.

Like a form's Load event, this event provides an opportunity to configure the control before it is displayed. It is in this event procedure that actions such as creating appearances, valuelists, and unbound columns should take place.

This event is generated when the control is first preparing to display data from the data source. This may occur when the data source changes.

Example
Following code initializes an UltraDropDown. It shows how you can change the order of columns, hide columns, sort items among other things.

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_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraDropDown1.InitializeLayout

      ' Set the scroll style to immediate so when the user scrolls the drop down 
      ' using scroll thumb, rows get scrolled imediately.
      e.Layout.ScrollStyle = ScrollStyle.Immediate

      ' Change the order in which columns get displayed in the UltraDropDown.
      e.Layout.Bands(0).Columns("ProductID").Header.VisiblePosition = 0
      e.Layout.Bands(0).Columns("ProductName").Header.VisiblePosition = 1

      ' Hide columns you don't want shown.
      e.Layout.Bands(0).Columns("UnitsOnOrder").Hidden = True

      ' Sort the items in the drop down by ProductName column.
      e.Layout.Bands(0).SortedColumns.Clear()
      e.Layout.Bands(0).SortedColumns.Add("ProductName", False)

      ' Set the border style of the drop down.
      e.Layout.BorderStyle = UIElementBorderStyle.Solid

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

private void ultraDropDown1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{

	// Set the scroll style to immediate so when the user scrolls the drop down 
	// using scroll thumb, rows get scrolled imediately.
	e.Layout.ScrollStyle = ScrollStyle.Immediate;

	// Change the order in which columns get displayed in the UltraDropDown.
	e.Layout.Bands[0].Columns["ProductID"].Header.VisiblePosition = 0;
	e.Layout.Bands[0].Columns["ProductName"].Header.VisiblePosition = 1;

	// Hide columns you don't want shown.
	e.Layout.Bands[0].Columns["UnitsOnOrder"].Hidden = true;

	// Sort the items in the drop down by ProductName column.
	e.Layout.Bands[0].SortedColumns.Clear( );
	e.Layout.Bands[0].SortedColumns.Add( "ProductName", false );

	// Set the border style of the drop down.
	e.Layout.BorderStyle = UIElementBorderStyle.Solid;	
		
}
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