'宣言 Public Property Group As UltraListViewGroup
public UltraListViewGroup Group {get; set;}
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(); }