Version

SubItemColumnsVisibleByDefault Property

Gets/sets whether columns whose VisibleInDetailsView property is left at the default value are displayed.
Syntax
'Declaration
 
Public Property SubItemColumnsVisibleByDefault As Boolean
public bool SubItemColumnsVisibleByDefault {get; set;}
Remarks

The SubItemColumnsVisibleByDefault property can be used in the case where there are a large number of columns that are not to be displayed. Typically, the end developer will set the SubItemColumnsVisibleByDefault property to false, and then set the VisibleInDetailsView property to true for the columns that are to be visible. Conversely, SubItemColumnsVisibleByDefault can be set to true to show all columns by default, while setting the VisibleInDetailsView to false for the ones that should be hidden.

When the SubItemColumnsVisibleByDefault property is set to false, columns are not displayed unless their VisibleInDetailsView property is explicitly set to true.

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