Version

Style Property (UltraGridColumn)

Determines the style of the column.
Syntax
'Declaration
 
Public Property Style As ColumnStyle
public ColumnStyle Style {get; set;}
Remarks

This property specifies what type of cell will be used to display and input data for the column.

The setting of this property for a column may affect other aspects of the control's operation. For example, using one of the dropdown styles requires the ValueList property of the column to be set in order to fill the dropdown list with text. It will also cause the CellListSelect event to be fired whenever an item is selected from the list. Similarly, setting this property to one of the button styles will cause the control to fire the ClickCellButton event.

Note: This property is for convenience. It lets you set the edit style of a column to one of the commonly used edit styles. This list does not include all the styles that are available. If a style is not listed in this enum then you can use the Editor property along with other properties that the UltraGridColumn object exposes, like MinValue, MaxValue, MinValueExclusive, MaxValueExclusive, MaskInput, FormatInfo, Format, MaxLength, RegexPattern etc... to accomplish the desired column style. As a matter of fact some the styles set some of the these properties to accomplish the desired behavior. For example the CurrencyPositive style sets the Editor to Infragistics.Win.EditorWithMask instance and the MinValueExclusive to 0. Also you can set these properties to further refine the behavior of a column style. This is because these properties take precedence over the Style property.

Example
Following code illustrates how to create a ValueList and assign it to a column. A ValueList maps data values to text. Depending on the value assigned to Style property of the column, cells in the column act like drop down lists or combo drop downs.

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

  Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button9.Click

      ' If the value list has already been created, then return since we
      ' don't want to recreate it again.
      If Me.ultraGrid1.DisplayLayout.ValueLists.Exists("VL1") Then Return

      ' Create a value list with the key of VL1.
      Dim valueList As valueList = Me.ultraGrid1.DisplayLayout.ValueLists.Add("VL1")

      ' Add some items to it. Here the items added have numeric data values and
      ' associated display texts. What the user sees in the cells is the display 
      ' text for these underlying numeric data value. Also when the user modifies
      ' a cell and selects one of the item, what goes in the data source is the
      ' associated numeric value.
      valueList.ValueListItems.Add(1, "One")
      valueList.ValueListItems.Add(2, "Two")
      valueList.ValueListItems.Add(3, "Three")
      valueList.ValueListItems.Add(4, "Four")
      valueList.ValueListItems.Add(5, "Five")

      ' Get the column you want to use the value list in.
      Dim column As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns(0)

      ' Now assign the value list to that column.
      column.ValueList = valueList

      ' Optionally set the style of that column to an appropriate drop down style.
      ' DropDownValidate style ensures that the user enters only the values found 
      ' in the value list. 
      column.Style = ColumnStyle.DropDownValidate

      ' When AutoEdit is turned on on a column with value list assigned to it, the
      ' UltraGrid auto-completes the text in the cell as the user types to a matching
      ' item in the value list. This is enabled by default, however you can turn it
      ' off by setting AutoEdit to false.
      column.AutoEdit = False

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

private void button9_Click(object sender, System.EventArgs e)
{		
	
	// If the value list has already been created, then return since we
	// don't want to recreate it again.
	if ( this.ultraGrid1.DisplayLayout.ValueLists.Exists( "VL1" ) )
		return;

	// Create a value list with the key of VL1.
	ValueList valueList = this.ultraGrid1.DisplayLayout.ValueLists.Add( "VL1" );
	
	// Add some items to it. Here the items added have numeric data values and
	// associated display texts. What the user sees in the cells is the display 
	// text for these underlying numeric data value. Also when the user modifies
	// a cell and selects one of the item, what goes in the data source is the
	// associated numeric value.
	valueList.ValueListItems.Add( 1, "One" );
	valueList.ValueListItems.Add( 2, "Two" );
	valueList.ValueListItems.Add( 3, "Three" );
	valueList.ValueListItems.Add( 4, "Four" );
	valueList.ValueListItems.Add( 5, "Five" );

	// Get the column you want to use the value list in.
	UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns[0];

	// Now assign the value list to that column.
	column.ValueList = valueList;
	
	// Optionally set the style of that column to an appropriate drop down style.
	// DropDownValidate style ensures that the user enters only the values found 
	// in the value list. 
	column.Style = ColumnStyle.DropDownValidate;

	// When AutoEdit is turned on on a column with value list assigned to it, the
	// UltraGrid auto-completes the text in the cell as the user types to a matching
	// item in the value list. This is enabled by default, however you can turn it
	// off by setting AutoEdit to false.
	column.AutoEdit = false;

}
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