Version

Group Property (UltraListViewItem)

Gets/sets the UltraListViewGroup to which this UltraListViewItem belongs.
Syntax
'Declaration
 
Public Property Group As UltraListViewGroup
public UltraListViewGroup Group {get; set;}
Remarks

Note: Groups are not displayed when the UltraListView control's View property is set to 'List'.

Example
The following code sample demonstrates how to handle the UltraListView's ItemActivating and ItemActivated events to change the color of a group's text when an item in that group becomes active:

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

    Private Sub ultraListView1_ItemActivating(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinListView.ItemActivatingEventArgs) Handles ultraListView1.ItemActivating
        Dim listView As UltraListView = CType(sender, UltraListView)
        Dim oldActiveItem As UltraListViewItem = listView.ActiveItem
        Dim newActiveItem As UltraListViewItem = e.Item

        '	If the item that is about to be activated belongs to
        '	a different group than the last active item, reset
        '	the last active group's appearance
        If Not oldActiveItem Is Nothing AndAlso _
          Not oldActiveItem.Group Is Nothing AndAlso _
          Not newActiveItem.Group Is Nothing AndAlso _
            Not oldActiveItem.Group Is newActiveItem.Group Then
            oldActiveItem.Group.ResetAppearance()
        End If

    End Sub

    Private Sub ultraListView1_ItemActivated(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinListView.ItemActivatedEventArgs) Handles ultraListView1.ItemActivated
        '    Set the ForeColor of the new ActiveItem's Group's Appearance to red.
        If Not e.Item.Group Is Nothing Then e.Item.Group.Appearance.ForeColor = Color.Red

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

		private void ultraListView1_ItemActivated(object sender, Infragistics.Win.UltraWinListView.ItemActivatedEventArgs e)
		{
			//	Set the ForeColor of the new ActiveItem's Group's Appearance to red.
			if ( e.Item.Group != null )
				e.Item.Group.Appearance.ForeColor = Color.Red;
		}

		private void ultraListView1_ItemActivating(object sender, Infragistics.Win.UltraWinListView.ItemActivatingEventArgs e)
		{
			UltraListView listView = sender as UltraListView;
			UltraListViewItem oldActiveItem = listView.ActiveItem;
			UltraListViewItem newActiveItem = e.Item;

			//	If the item that is about to be activated belongs to
			//	a different group than the last active item, reset
			//	the last active group's appearance
			if ( oldActiveItem != null &&
				 oldActiveItem.Group != null &&
				 newActiveItem.Group != null &&
				 oldActiveItem.Group != newActiveItem.Group )
				oldActiveItem.Group.ResetAppearance();		
		}
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