バージョン

Groups プロパティ

シンタックス
'宣言
 
Public ReadOnly Property Groups As UltraListViewGroupsCollection
public UltraListViewGroupsCollection Groups {get;}
使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

        '	Get a reference to the 'Customers', 'Employees', and
        '	'Orders' tables from the Northwind database
        Dim dataSet As DataSet = New DataSet()
        Me.customersAdapter.Fill(dataSet)
        Me.employeesAdapter.Fill(dataSet)
        Me.ordersAdapter.Fill(dataSet)
        Me.shippersAdapter.Fill(dataSet)
        Dim customersTable As DataTable = dataSet.Tables("Customers")
        Dim employeesTable As DataTable = dataSet.Tables("Employees")
        Dim ordersTable As DataTable = dataSet.Tables("Orders")
        Dim shippersTable As DataTable = dataSet.Tables("Shippers")

        '	Set the UltraListView's View property to 'Details'
        Me.ultraListView1.View = UltraListViewStyle.Details

        '	Set the UltraListView's AutoKeyboardSearch property to true,
        '	so the end user can perform alpha-numeric searches
        Me.ultraListView1.AutoKeyboardSearch = True

			 '	Allow extended selection for items
			 Me.ultraListView1.ItemSettings.SelectionType = SelectionType.Extended

			 '	Enable HotTracking
			 Me.ultraListView1.ItemSettings.HotTracking = true

			 '	Show selected appearance colors when the control does not have focus
			 Me.ultraListView1.ItemSettings.HideSelection = false

			 '	Allow extended selection for items
			 Me.ultraListView1.ItemSettings.SelectionType = SelectionType.Extended

        '	Disable editing for the UltraListView.
        Me.ultraListView1.ItemSettings.AllowEdit = DefaultableBoolean.False

        '	Display checkboxes next to the items
        Me.ultraListView1.ViewSettingsDetails.CheckBoxStyle = CheckBoxStyle.CheckBox
        Me.ultraListView1.ViewSettingsList.CheckBoxStyle = CheckBoxStyle.CheckBox

        '	Adjust the ImageSize property so that images are not displayed
        '	for the list styles
        Me.ultraListView1.ViewSettingsDetails.ImageSize = Size.Empty
        Me.ultraListView1.ViewSettingsList.ImageSize = Size.Empty

        '	Set the FullRowSelect property to true for Details view
        Me.ultraListView1.ViewSettingsDetails.FullRowSelect = True

        '	Clear the Items, Groups, and SubItemColumns collections
        Me.ultraListView1.Items.Clear()
        Me.ultraListView1.Groups.Clear()
        Me.ultraListView1.SubItemColumns.Clear()

        '	Populate the Groups collection from the 'Customers' table
        Dim dataRow As DataRow
        For Each dataRow In customersTable.Rows

            '	Add an UltraListViewGroup to represent this customer, using
            '	the value of the 'CustomerID' field for the group's Key.
            Dim group As UltraListViewGroup = Me.ultraListView1.Groups.Add(CType(dataRow("CustomerID"), String))

            '	Assign the value of the 'CompanyName' field to the group's Text property.
            group.Text = CType(dataRow("CompanyName"), String)

        Next

			'	Set ShowGroups to true so that groups are shown
        Me.ultraListView1.ShowGroups = True

        '	Create a ValueList, which we will populate with the contents of
        '	the 'Employees' table. Use the value of the 'EmployeeID' field
        '	for the DataValue, and the employee's name for the DisplayText.
        '	Also, store a reference to the underlying DataRow in the
        '	ValueListItem's Tag property.
        Dim employeesValueList As ValueList = New ValueList()
        For Each dataRow In employeesTable.Rows

            Dim employeeName As String = String.Format("{0} {1}", dataRow("FirstName"), dataRow("LastName"))
            Dim valueListItem As ValueListItem = employeesValueList.ValueListItems.Add(dataRow("EmployeeID"), employeeName)
            valueListItem.Tag = dataRow

        Next


        '	Create a ValueList, which we will populate with the contents of
        '	the 'Shippers' table. Use the value of the 'ShipperID' field
        '	for the DataValue, and the shipper's name for the DisplayText.
        '	Also, store a reference to the underlying DataRow in the
        '	ValueListItem's Tag property.
        Dim shippersValueList As ValueList = New ValueList()
        For Each dataRow In shippersTable.Rows

            Dim shipperName As String = CType(dataRow("CompanyName"), String)
            Dim shipperID As Int32 = CType(dataRow("ShipperID"), Int32)
            Dim valueListItem As ValueListItem = shippersValueList.ValueListItems.Add(shipperID, shipperName)
            valueListItem.Tag = dataRow


            '	Create an Appearance for this shipper, and add it to the
            '	UltraListView's Appearances collection.
            Dim appearance As Infragistics.Win.Appearance = Me.ultraListView1.Appearances.Add(shipperName)
            Select Case shipperID

                Case 1
                    appearance.ForeColor = Color.Red
                Case 2
                    appearance.ForeColor = Color.Green
                Case 3
                    appearance.ForeColor = Color.Blue
            End Select

        Next

        '	Populate the SubItemColumns collection from the Columns in the 'Orders' table
        Me.PopulateSubItemColumnsCollection(ordersTable, employeesValueList, shippersValueList)

        '	Populate the Items collection from the Rows in the 'Orders' table
        Me.PopulateItemsCollection(ordersTable)
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using System.Diagnostics;

			//	Get a reference to the 'Customers', 'Employees', and
			//	'Orders' tables from the Northwind database
			DataSet dataSet = new DataSet();
			this.customersAdapter.Fill( dataSet );
			this.employeesAdapter.Fill( dataSet );
			this.ordersAdapter.Fill( dataSet );
			this.shippersAdapter.Fill( dataSet );
			DataTable customersTable = dataSet.Tables["Customers"];
			DataTable employeesTable = dataSet.Tables["Employees"];
			DataTable ordersTable = dataSet.Tables["Orders"];
			DataTable shippersTable = dataSet.Tables["Shippers"];

			//	Set the UltraListView's View property to 'Details'
			this.ultraListView1.View = UltraListViewStyle.Details;

			//	Allow extended selection for items
			this.ultraListView1.ItemSettings.SelectionType = SelectionType.Extended;

			//	Enable HotTracking
			this.ultraListView1.ItemSettings.HotTracking = true;

			//	Show selected appearance colors when the control does not have focus
			this.ultraListView1.ItemSettings.HideSelection = false;

			//	Set the UltraListView's AutoKeyboardSearch property to true,
			//	so the end user can perform alpha-numeric searches
			this.ultraListView1.AutoKeyboardSearch = true;

			//	Disable editing for the UltraListView.
			this.ultraListView1.ItemSettings.AllowEdit = DefaultableBoolean.False;

			//	Display checkboxes next to the items
			this.ultraListView1.ViewSettingsDetails.CheckBoxStyle = CheckBoxStyle.CheckBox;
			this.ultraListView1.ViewSettingsList.CheckBoxStyle = CheckBoxStyle.CheckBox;

			//	Adjust the ImageSize property so that images are not displayed
			//	for the list styles
			this.ultraListView1.ViewSettingsDetails.ImageSize = Size.Empty;
			this.ultraListView1.ViewSettingsList.ImageSize = Size.Empty;

			//	Set the FullRowSelect property to true for Details view
			this.ultraListView1.ViewSettingsDetails.FullRowSelect = true;

			//	Clear the Items, Groups, and SubItemColumns collections
			this.ultraListView1.Items.Clear();
			this.ultraListView1.Groups.Clear();
			this.ultraListView1.SubItemColumns.Clear();

			//	Populate the Groups collection from the 'Customers' table
			foreach( DataRow dataRow in customersTable.Rows )
			{
				//	Add an UltraListViewGroup to represent this customer, using
				//	the value of the 'CustomerID' field for the group's Key.
				UltraListViewGroup group = this.ultraListView1.Groups.Add( dataRow["CustomerID"] as string );

				//	Assign the value of the 'CompanyName' field to the group's Text property.
				group.Text = dataRow["CompanyName"] as string;
			}

			//	Set ShowGroups to true so that groups are shown
        this.ultraListView1.ShowGroups = true;

			//	Create a ValueList, which we will populate with the contents of
			//	the 'Employees' table. Use the value of the 'EmployeeID' field
			//	for the DataValue, and the employee's name for the DisplayText.
			//	Also, store a reference to the underlying DataRow in the
			//	ValueListItem's Tag property.
			ValueList employeesValueList = new ValueList();
			foreach( DataRow dataRow in employeesTable.Rows )
			{
				string employeeName = string.Format( "{0} {1}", dataRow["FirstName"], dataRow["LastName"] );
				ValueListItem valueListItem = employeesValueList.ValueListItems.Add( dataRow["EmployeeID"], employeeName );
				valueListItem.Tag = dataRow;
			}

			//	Create a ValueList, which we will populate with the contents of
			//	the 'Shippers' table. Use the value of the 'ShipperID' field
			//	for the DataValue, and the shipper's name for the DisplayText.
			//	Also, store a reference to the underlying DataRow in the
			//	ValueListItem's Tag property.
			ValueList shippersValueList = new ValueList();
			foreach( DataRow dataRow in shippersTable.Rows )
			{
				string shipperName = dataRow["CompanyName"] as string;
				int shipperID = (int)dataRow["ShipperID"];
				ValueListItem valueListItem = shippersValueList.ValueListItems.Add( shipperID, shipperName );
				valueListItem.Tag = dataRow;

				
				//	Create an Appearance for this shipper, and add it to the
				//	UltraListView's Appearances collection.
				Infragistics.Win.Appearance appearance = this.ultraListView1.Appearances.Add( shipperName );
				switch ( shipperID )
				{
					case 1: { appearance.ForeColor = Color.Red; break; }
					case 2: { appearance.ForeColor = Color.Green; break; }
					case 3: { appearance.ForeColor = Color.Blue; break; }
				}
			}

			//	Populate the SubItemColumns collection from the Columns in the 'Orders' table
			this.PopulateSubItemColumnsCollection( ordersTable, employeesValueList, shippersValueList );

			//	Populate the Items collection from the Rows in the 'Orders' table
			this.PopulateItemsCollection( ordersTable );
参照