Version

BeforeColumnChooserDisplayedEventArgs Class

EventArgs for BeforeColumnChooserDisplayed event.
Syntax
'Declaration
 
Public Class BeforeColumnChooserDisplayedEventArgs 
   Inherits System.ComponentModel.CancelEventArgs
public class BeforeColumnChooserDisplayedEventArgs : System.ComponentModel.CancelEventArgs 
Example
The following code shows properties, events and methods related to the Column Chooser functionality.

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_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraGrid1.InitializeLayout
        ' UltraGrid has a built-in ui for displaying column chooser dialog. To enable
        ' the ui enable the row selectors and set the RowSelectorHeaderStyle to 
        ' ColumnChooserButton.
        e.Layout.Override.RowSelectors = DefaultableBoolean.True
        e.Layout.Override.RowSelectorHeaderStyle = RowSelectorHeaderStyle.ColumnChooserButton

        ' You can exclude a column from the column chooser by setting the ExcludeFromColumnChooser
        ' property to True. This will prevent the user from hiding or unhiding the column.
        e.Layout.Bands(0).Columns("CustomerID").ExcludeFromColumnChooser = ExcludeFromColumnChooser.True

        ' ExcludeFromColumnChooser is also exposed on the band object. So you can exlude a whole
        ' band from the column chooser.
        e.Layout.Bands(1).ExcludeFromColumnChooser = ExcludeFromColumnChooser.True

        ' ColumnChooserCaption property lets you display a different caption in the column
        ' chooser than in the UltraGrid.
        e.Layout.Bands(0).Columns(1).ColumnChooserCaption = "Column Chooser Caption"
    End Sub

    Private Sub UltraGrid1_BeforeColumnChooserDisplayed(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeColumnChooserDisplayedEventArgs) Handles ultraGrid1.BeforeColumnChooserDisplayed
        ' UltraGrid fires BeforeColumnChooserDisplayed event whenever it's about to
        ' display the column chooser dialog, either via the ColumnChooserButton or
        ' when the ShowColumnChooser method is called on the UltraGrid.

        ' You can access the column chooser dialog that will be displayed using the
        ' Dialog property. Here you can change location, size among other settings
        ' of the dialog.
        e.Dialog.Size = New Size(200, 300)

        ' By default UltraGrid retains the column chooser dialog instance. You can 
        ' set the DisposeOnClose to True to cause the UltraGrid to dispose the dialog 
        ' when it's closed by the user.
        e.Dialog.DisposeOnClose = DefaultableBoolean.True

        ' You can use the ColumnChooserControl property of the dialog to access the
        ' column chooser control that actually displays the list of the columns.
        e.Dialog.ColumnChooserControl.MultipleBandSupport = MultipleBandSupport.SingleBandOnly
        e.Dialog.ColumnChooserControl.Style = ColumnChooserStyle.AllColumnsWithCheckBoxes

        ' By default column chooser attempts to look similar to the source grid whose
        ' columns are being displayed in the column chooser. You can set the
        ' SyncLookWithSourceGrid to false to prevent column chooser from doing this
        ' This will also ensure that the column chooser won't override your appearance
        ' settings.
        e.Dialog.ColumnChooserControl.SyncLookWithSourceGrid = False
        e.Dialog.ColumnChooserControl.DisplayLayout.Appearance.BackColor = SystemColors.Window
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' You can display the column chooser dialog in code using one of the many
        ' overloads of ShowColumnChooser method.
        Me.ultraGrid1.ShowColumnChooser()
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// UltraGrid has a built-in ui for displaying column chooser dialog. To enable
			// the ui enable the row selectors and set the RowSelectorHeaderStyle to 
			// ColumnChooserButton.
			e.Layout.Override.RowSelectors = DefaultableBoolean.True;
			e.Layout.Override.RowSelectorHeaderStyle = RowSelectorHeaderStyle.ColumnChooserButton;

			// You can exclude a column from the column chooser by setting the ExcludeFromColumnChooser
			// property to True. This will prevent the user from hiding or unhiding the column.
			e.Layout.Bands[0].Columns["CustomerID"].ExcludeFromColumnChooser = ExcludeFromColumnChooser.True;

			// ExcludeFromColumnChooser is also exposed on the band object. So you can exlude a whole
			// band from the column chooser.
			e.Layout.Bands[1].ExcludeFromColumnChooser = ExcludeFromColumnChooser.True;

			// ColumnChooserCaption property lets you display a different caption in the column
			// chooser than in the UltraGrid.
			e.Layout.Bands[0].Columns[1].ColumnChooserCaption = "Column Chooser Caption";
		}

		private void ultraGrid1_BeforeColumnChooserDisplayed(object sender, Infragistics.Win.UltraWinGrid.BeforeColumnChooserDisplayedEventArgs e)
		{
			// UltraGrid fires BeforeColumnChooserDisplayed event whenever it's about to
			// display the column chooser dialog, either via the ColumnChooserButton or
			// when the ShowColumnChooser method is called on the UltraGrid.

			// You can access the column chooser dialog that will be displayed using the
			// Dialog property. Here you can change location, size among other settings
			// of the dialog.
			e.Dialog.Size = new Size( 200, 3500 );

			// By default UltraGrid retains the column chooser dialog instance. You can 
			// set the DisposeOnClose to True to cause the UltraGrid to dispose the dialog 
			// when it's closed by the user.
			e.Dialog.DisposeOnClose = DefaultableBoolean.True;

			// You can use the ColumnChooserControl property of the dialog to access the
			// column chooser control that actually displays the list of the columns.
			e.Dialog.ColumnChooserControl.MultipleBandSupport = MultipleBandSupport.SingleBandOnly;
			e.Dialog.ColumnChooserControl.Style = ColumnChooserStyle.AllColumnsWithCheckBoxes;

			// By default column chooser attempts to look similar to the source grid whose
			// columns are being displayed in the column chooser. You can set the
			// SyncLookWithSourceGrid to false to prevent column chooser from doing this
			// This will also ensure that the column chooser won't override your appearance
			// settings.
			e.Dialog.ColumnChooserControl.SyncLookWithSourceGrid = false;
			e.Dialog.ColumnChooserControl.DisplayLayout.Appearance.BackColor = SystemColors.Window;			
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			// You can display the column chooser dialog in code using one of the many
			// overloads of ShowColumnChooser method.
			this.ultraGrid1.ShowColumnChooser( );
		}
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