Version

DataType Property

Returns the column's underlying data type. This property is read-only for bound columns.
Syntax
'Declaration
 
Public Property DataType As Type
public Type DataType {get; set;}
Remarks

You can use this property to determine what type of data from the data source is expected or supplied by the field that is bound to the column. DataType values correspond to the standard data field types available through the data provider.

When this property is set to 136 (DataTypeChapter), the Hidden, Locked, Width, MinWidth, MaxWidth, and Selected properties are ignored for the column.

This property cannot be set to 72 (DataTypeGuid) or 136 (DataTypeChapter) for unbound columns.

Example
IsBound indicates whether a column is a bound column or an unbound column. Bound columns are the columns that come from the bound data source. Unbound columns are the columns that you add to the ColumnsCollection returned by Columns property of the UltraGridband. Following sample code shows you how to add an unbound column and then loops through all the columns printing out whether each of the columns is a bound column or unbound column.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Button14_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button14.Click

       Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0)

       ' Check if the column has already been added.
       If Not band.Columns.Exists("UBColumn1") Then
           ' Add an unbound column with the key of "UBColumn1"
           band.Columns.Add("UBColumn1")
           band.Columns("UBColumn1").DataType = GetType(String)
       End If

       ' Loop through all the columns and print out the keys of the columns that are
       ' unbound. There will be only one such column since we've added only one unbound
       ' column above.
       Dim i As Integer
       For i = 0 To band.Columns.Count - 1
           ' IsBound indicates whether a column is a bound column or is an unbound column.
           If Not band.Columns(i).IsBound Then
               Debug.WriteLine(band.Columns(i).Key & " is an unbound column")
           Else
               ' Each bound column has a PropertyDescriptor associated with it. PropertyDescriptor is 
               ' associated with a column or field in the underlying data structure. The UltraGrid
               ' gets property descriptors through BindingManagerBase.GetItemProperties method.
               Dim pd As System.ComponentModel.PropertyDescriptor = band.Columns(i).PropertyDescriptor

               Debug.WriteLine(band.Columns(i).Key & " is a bound column. Property descriptor info: Name = " & pd.Name & ", Type = " & pd.PropertyType.Name)
           End If
       Next

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

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

	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];

	// Check if the column has already been added.
	if ( !band.Columns.Exists( "UBColumn1" ) )
	{	
		// Add an unbound column with the key of "UBColumn1"				
		band.Columns.Add( "UBColumn1" );
		band.Columns["UBColumn1"].DataType = typeof( string );
	}

	// Loop through all the columns and print out the keys of the columns that are
	// unbound. There will be only one such column since we've added only one unbound
	// column above.
	for ( int i = 0; i < band.Columns.Count; i++ )
	{
		// IsBound indicates whether a column is a bound column or is an unbound column.
		if ( !band.Columns[i].IsBound )
		{
			Debug.WriteLine( band.Columns[i].Key + " is an unbound column" );
		}
		else
		{
			// Each bound column has a PropertyDescriptor associated with it. PropertyDescriptor is 
			// associated with a column or field in the underlying data structure. The UltraGrid
			// gets property descriptors through BindingManagerBase.GetItemProperties method.
			System.ComponentModel.PropertyDescriptor pd = band.Columns[i].PropertyDescriptor;

			Debug.WriteLine( band.Columns[i].Key + " is a bound column. Property descriptor info: Name = " + pd.Name + ", Type = " + pd.PropertyType.Name );
		}
	}

}
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