Version

SubItemColumns Property

Returns the collection of UltraListViewSubItemColumn objects which define the columns displayed by the control under which sub-items appear.
Syntax
'Declaration
 
Public ReadOnly Property SubItemColumns As UltraListViewSubItemColumnsCollection
public UltraListViewSubItemColumnsCollection SubItemColumns {get;}
Remarks

The column under which the item's UltraListViewItemBase.Text is displayed does not belong to the SubItemColumns collection. This column has special significance, and is returned by the control's MainColumn property. The MainColumn cannot be removed or hidden, since it displayed the item's value.

The SubItemColumns collection contains the UltraListViewSubItemColumn instances which determines how sub-items are displayed by the control in 'Details' and 'Tiles' view. In 'Details' view, the SubItemColumns collection defines the headers that are displayed, and the sub-item values are displayed under these headers. In 'Tiles' view, the SubItemColumns collection defines the sub-item values that are displayed underneath the item's own Value.

The SubItemColumns collection is only used when the control's View property is set to 'Details' or 'Tiles'.

Since column headers only appear when the control's View property is set to 'Details', the properties which apply to column headers are found under the ViewSettingsDetails object property.

Example
The following code sample demonstrates how to populate the UltraListView control's SubitemColumns collection from the 'Orders' table of the Northwind database:

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

    Private Sub PopulateSubItemColumnsCollection(ByVal ordersTable As DataTable, ByVal employeesValueList As ValueList, ByVal shippersValueList As ValueList)

        Dim dataRow As DataRow

        '	Use the UltraListView's MainColumn to represent the 'OrderID' column
        '	of the 'Orders' table.
        Dim mainDataColumn As DataColumn = ordersTable.Columns("OrderID")
        Me.ultraListView1.MainColumn.Text = mainDataColumn.Caption
        Me.ultraListView1.MainColumn.DataType = mainDataColumn.DataType

        '	Populate the SubItemColumns collection from the Columns collection of the
        '	'Orders' table
        Dim dataColumn As DataColumn
        For Each dataColumn In ordersTable.Columns

            If dataColumn Is mainDataColumn Then GoTo skip

            '	Add an UltraListViewSubItemColumn to the UltraListView's SubItemColumns collection,
            '	using the DataColumn's ColumnName for the Key.
            Dim subItemColumn As UltraListViewSubItemColumn = Me.ultraListView1.SubItemColumns.Add(dataColumn.ColumnName)

            '	Set the UltraListViewSubItemColumn's Text property to the DataColumn's Caption.
            subItemColumn.Text = dataColumn.Caption

            '	Set the UltraListViewSubItemColumn's DataType property to the DataColumn's DataType.
            subItemColumn.DataType = dataColumn.DataType

            '	Hide the columns that the end user does not need to see.
            If subItemColumn.Key = "CustomerID" Or _
              subItemColumn.Key = "ShipName" Or _
              subItemColumn.Key = "ShipAddress" Or _
              subItemColumn.Key = "ShipCity" Or _
              subItemColumn.Key = "ShipRegion" Or _
              subItemColumn.Key = "ShipPostalCode" Or _
              subItemColumn.Key = "ShipCountry" Then

                subItemColumn.VisibleInDetailsView = DefaultableBoolean.False
                subItemColumn.VisibleInTilesView = DefaultableBoolean.False
            End If

            '	Assign the employees ValueList to the 'EmployeeID' column.
            If subItemColumn.Key = "EmployeeID" Then subItemColumn.ValueList = employeesValueList

            '	Assign the shippers ValueList to the 'ShipVia' column.
            If subItemColumn.Key = "ShipVia" Then subItemColumn.ValueList = shippersValueList

            '	Allow the UltraListViewSubItemColumn to be moved
            subItemColumn.AllowMoving = DefaultableBoolean.True

            '	Allow the UltraListViewSubItemColumn to be resized
            subItemColumn.AllowSizing = DefaultableBoolean.True

            '	Allow the UltraListViewSubItemColumn to be sorted
            subItemColumn.AllowSorting = DefaultableBoolean.True

            '	Set the FormatProvider to null so that the current culture is used.
            subItemColumn.FormatProvider = Nothing

            '	Set some UltraListViewSubItemColumn properties based the data type
            If subItemColumn.DataType Is GetType(System.DateTime) Then

                '	Use the current culture's ShortDatePattern to format dates
                subItemColumn.Format = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern

                '	Customize the NullText for this data type.
                subItemColumn.NullText = "(No Date Set)"
            ElseIf subItemColumn.DataType Is GetType(System.Decimal) Then

                '	Since the currency values are expressed in US dollars, assign
                '	a currency format that is appropriate for that currency system,
                '	and assign 'English - United States' to the FormatProvider property.
                subItemColumn.Format = "$#,###,###.00"
                subItemColumn.FormatProvider = System.Globalization.CultureInfo.CreateSpecificCulture("en-US")

                '	Customize the NullText for this data type.
                subItemColumn.NullText = "(No Amount Set)"

                '	Right-align the text for this column
                subItemColumn.SubItemAppearance.TextHAlign = HAlign.Right

                '	Use the SubItemAppearance's ForeColor property to customize the
                '	color of text for this column.
                subItemColumn.SubItemAppearance.ForeColor = Color.Green
            End If

            '	Assign a reference to the DataColumn to the UltraListViewSubItemColumn's
            '	Tag property.
            subItemColumn.Tag = dataColumn
skip:
        Next

    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using System.Diagnostics;

		private void PopulateSubItemColumnsCollection( DataTable ordersTable, ValueList employeesValueList, ValueList shippersValueList )
		{
			//	Use the UltraListView's MainColumn to represent the 'OrderID' column
			//	of the 'Orders' table.
			DataColumn mainDataColumn = ordersTable.Columns["OrderID"];
			this.ultraListView1.MainColumn.Text = mainDataColumn.Caption;
			this.ultraListView1.MainColumn.DataType = mainDataColumn.DataType;

			//	Populate the SubItemColumns collection from the Columns collection of the
			//	'Orders' table
			foreach( DataColumn dataColumn in ordersTable.Columns )
			{
				if ( dataColumn == mainDataColumn )
					continue;

				//	Add an UltraListViewSubItemColumn to the UltraListView's SubItemColumns collection,
				//	using the DataColumn's ColumnName for the Key.
				UltraListViewSubItemColumn subItemColumn = this.ultraListView1.SubItemColumns.Add( dataColumn.ColumnName );

				//	Set the UltraListViewSubItemColumn's Text property to the DataColumn's Caption.
				subItemColumn.Text = dataColumn.Caption;

				//	Set the UltraListViewSubItemColumn's DataType property to the DataColumn's DataType.
				subItemColumn.DataType = dataColumn.DataType;

				//	Hide the columns that the end user does not need to see.
				if ( subItemColumn.Key == "CustomerID" ||
					 subItemColumn.Key == "ShipName" ||
					 subItemColumn.Key == "ShipAddress" ||
					 subItemColumn.Key == "ShipCity" ||
					 subItemColumn.Key == "ShipRegion" ||
					 subItemColumn.Key == "ShipPostalCode" ||
					 subItemColumn.Key == "ShipCountry" )

				{
					subItemColumn.VisibleInDetailsView = DefaultableBoolean.False;
					subItemColumn.VisibleInTilesView = DefaultableBoolean.False;
				}

				//	Assign the employees ValueList to the 'EmployeeID' column.
				if ( subItemColumn.Key == "EmployeeID" )
					subItemColumn.ValueList = employeesValueList;

				//	Assign the shippers ValueList to the 'ShipVia' column.
				if ( subItemColumn.Key == "ShipVia" )
					subItemColumn.ValueList = shippersValueList;

				//	Allow the UltraListViewSubItemColumn to be moved
				subItemColumn.AllowMoving = DefaultableBoolean.True;

				//	Allow the UltraListViewSubItemColumn to be resized
				subItemColumn.AllowSizing = DefaultableBoolean.True;

				//	Allow the UltraListViewSubItemColumn to be sorted
				subItemColumn.AllowSorting = DefaultableBoolean.True;

				//	Set the FormatProvider to null so that the current culture is used.
				subItemColumn.FormatProvider = null;

				//	Set some UltraListViewSubItemColumn properties based the data type
				if ( subItemColumn.DataType == typeof(System.DateTime) )
				{
					//	Use the current culture's ShortDatePattern to format dates
					subItemColumn.Format = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

					//	Customize the NullText for this data type.
					subItemColumn.NullText = "(No Date Set)";
				}
				else
				if ( subItemColumn.DataType == typeof(System.Decimal) )
				{
					//	Since the currency values are expressed in US dollars, assign
					//	a currency format that is appropriate for that currency system,
					//	and assign 'English - United States' to the FormatProvider property.
					subItemColumn.Format = "$#,###,###.00";
					subItemColumn.FormatProvider = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

					//	Customize the NullText for this data type.
					subItemColumn.NullText = "(No Amount Set)";
					
					//	Right-align the text for this column
					subItemColumn.SubItemAppearance.TextHAlign = HAlign.Right;

					//	Use the SubItemAppearance's ForeColor property to customize the
					//	color of text for this column.
					subItemColumn.SubItemAppearance.ForeColor = Color.Green;
				}

				//	Assign a reference to the DataColumn to the UltraListViewSubItemColumn's
				//	Tag property.
				subItemColumn.Tag = dataColumn;
			}

		}
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