Version

AllowColSwapping Property

Returns or sets a value that determines whether the user is allowed to swap columns.
Syntax
'Declaration
 
Public Property AllowColSwapping As AllowColSwapping
public AllowColSwapping AllowColSwapping {get; set;}
Remarks

The AllowColSwapping property determines how columns can be swapped by the user in the band or the grid controlled by the specified override. Depending on the setting of AllowColSwapping, users can swap columns within the band, within a group, or not at all. In order for the user to be able to swap columns, column headers must be visible. If AllowColSwapping is set to allow column swapping within the band or the group, the column headers will display a dropdown interface that is used to select the column that will be swapped with the current one. The contents of the dropdown list are also affected by the setting of AllowColSwapping.

This property does not affect the ability of users to move columns using the column moving functionality of the column headers (controlled by the AllowColMoving property) or on the ability of the user to swap groups within the grid (controlled by the AllowGroupSwapping property).

Example
Following code sets some properties related to column moving.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button8.Click

      ' Set the HeaderClickAction to Select to allow the user to select one or more
      ' columns by clicking and draggin the mouse over column headers.
      Me.ultraGrid1.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Select

      ' Controls column sizing aspect of the columns. Free means the user can resize a column
      ' independent of columns in other bands. By default columns are syncronized, meaning
      ' columns with the same visible positions in different bands will be syncronized.
      Me.ultraGrid1.DisplayLayout.Override.AllowColSizing = AllowColSizing.Free

      ' Turn on column swapping. This will make small drop down arrows appear on the column
      ' headers that will allow the user to swap two columns easily by dropping down a 
      ' drop down with a list of columns to swap with.
      Me.ultraGrid1.DisplayLayout.Override.AllowColSwapping = AllowColSwapping.WithinBand

      ' Allow the user to move columns around.
      Me.ultraGrid1.DisplayLayout.Override.AllowColMoving = AllowColMoving.WithinBand

      ' Set the VisiblePosition to 0. We want the customer id column to be the first column.			
      Me.ultraGrid1.DisplayLayout.Bands(0).Columns("CustomerID").Header.VisiblePosition = 0

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

private void button8_Click(object sender, System.EventArgs e)
{

	// Set the HeaderClickAction to Select to allow the user to select one or more
	// columns by clicking and draggin the mouse over column headers.
	this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Select;

	// Controls column sizing aspect of the columns. Free means the user can resize a column
	// independent of columns in other bands. By default columns are syncronized, meaning
	// columns with the same visible positions in different bands will be syncronized.
	this.ultraGrid1.DisplayLayout.Override.AllowColSizing = AllowColSizing.Free;

	// Turn on column swapping. This will make small drop down arrows appear on the column
	// headers that will allow the user to swap two columns easily by dropping down a 
	// drop down with a list of columns to swap with.
	this.ultraGrid1.DisplayLayout.Override.AllowColSwapping = AllowColSwapping.WithinBand;

	// Allow the user to move columns around.
	this.ultraGrid1.DisplayLayout.Override.AllowColMoving = AllowColMoving.WithinBand;

	// Set the VisiblePosition to 0. We want the customer id column to be the first column.			
	this.ultraGrid1.DisplayLayout.Bands[0].Columns["CustomerID"].Header.VisiblePosition = 0;

}
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