Version

Items Property (UltraListView)

Returns the collection of UltraListViewItem objects.
Syntax
'Declaration
 
Public ReadOnly Property Items As UltraListViewItemsCollection
public UltraListViewItemsCollection Items {get;}
Remarks

The Items collection contains the items that are displayed by the UltraListView control. The collection is of type UltraListViewItemsCollection, which exposes methods such as UltraListViewItemsCollection.Add, UltraListViewItemsCollection.AddRange, UltraListViewItemsCollection.Remove, and UltraListViewItemsCollection.Clear, which make it possible to manipulate the contents of the collection. Each member of the collection is of type UltraListViewItem, which in turn exposes a SubItems collection. The SubItems collection contains the sub-items for that item; note that, unlike the members of the Items collection, the members of the SubItems collection are not displayed for all views.

The members of the Items collection can be sorted by setting the Sorting property of the MainColumn or one of the members of the SubItemColumns collection. The Sorting property can be set to programmatically sort items by that column; for more control over the way items are sorted the end developer can assign a custom IComparer implementation to the column's SortComparer property.

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

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

    Private Sub PopulateItemsCollection(ByVal ordersTable As DataTable)

        Dim dataRow As DataRow
        Dim dataColumn As DataColumn

        '	Populate the Items collection from the Rows collection of the 'Orders' table.
        For Each dataRow In ordersTable.Rows

            '	Add an UltraListViewItem for this order, using the value of the
            '	'OrderID' field for the item's Value
            Dim orderItem As UltraListViewItem = Me.ultraListView1.Items.Add(Nothing, dataRow("OrderID"))

            '	Set the values for the UltraListViewItem's SubItems. Note that we
            '	can use an UltraListViewSubItemColumn instance to index into the
            '	SubItemColumns collection, and use the stored reference to the underlying
            '	DataColumn to index into the DataRow's columns.
            Dim subItemColumn As UltraListViewSubItemColumn
            For Each subItemColumn In Me.ultraListView1.SubItemColumns

                DataColumn = CType(subItemColumn.Tag, DataColumn)
                Dim subItem As UltraListViewSubItem = orderItem.SubItems(subItemColumn)
                subItem.Value = dataRow(DataColumn)

                '	Assign the Appearance we created for this shipper to the
                '	UltraListViewSubItem's Appearance.
                If subItem.Key = "ShipVia" Then subItem.Appearance = Me.ultraListView1.Appearances(subItem.Text)
            Next

            '	Assign the UltraListViewGroup which represents this order's customer
            '	to the item's Group property.
            Dim customerID As String = CType(dataRow("CustomerID"), String)
            orderItem.Group = Me.ultraListView1.Groups(customerID)
        Next

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


		private void PopulateItemsCollection( DataTable ordersTable )
		{
			//	Populate the Items collection from the Rows collection of the 'Orders' table.
			foreach( DataRow dataRow in ordersTable.Rows )
			{
				//	Add an UltraListViewItem for this order, using the value of the
				//	'OrderID' field for the item's Value
				UltraListViewItem orderItem = this.ultraListView1.Items.Add( null, dataRow["OrderID"] );

				//	Set the values for the UltraListViewItem's SubItems. Note that we
				//	can use an UltraListViewSubItemColumn instance to index into the
				//	SubItemColumns collection, and use the stored reference to the underlying
				//	DataColumn to index into the DataRow's columns.
				foreach( UltraListViewSubItemColumn subItemColumn in this.ultraListView1.SubItemColumns )
				{
					DataColumn dataColumn = subItemColumn.Tag as DataColumn;
					UltraListViewSubItem subItem = orderItem.SubItems[subItemColumn];
					subItem.Value = dataRow[dataColumn];

					//	Assign the Appearance we created for this shipper to the
					//	UltraListViewSubItem's Appearance.
					if ( subItem.Key == "ShipVia" )
						subItem.Appearance = this.ultraListView1.Appearances[subItem.Text];
				}

				//	Assign the UltraListViewGroup which represents this order's customer
				//	to the item's Group property.
				string customerID = dataRow["CustomerID"] as string;
				orderItem.Group = this.ultraListView1.Groups[customerID];
			}
		}
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