'Declaration Public ReadOnly Property SubItems As UltraListViewSubItemsCollection
public UltraListViewSubItemsCollection SubItems {get;}
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]; } }
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