バージョン

SubItemAppearance プロパティ (UltraListViewTilesSettings)

シンタックス
'宣言
 
Public Property SubItemAppearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase SubItemAppearance {get; set;}
使用例
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;
			}

		}
参照