'Declaration Public Event ItemCheckStateChanging As ItemCheckStateChangingEventHandler
public event ItemCheckStateChangingEventHandler ItemCheckStateChanging
The event handler receives an argument of type ItemCheckStateChangingEventArgs containing data related to this event. The following ItemCheckStateChangingEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | |
Item (Inherited from Infragistics.Win.UltraWinListView.CancelableItemEventArgs) | Returns the UltraListViewItem with which this instance is associated. |
NewValue | Gets/sets the new value for the associated UltraListViewItem object's CheckState property. |
Imports Infragistics.Win Imports Infragistics.Win.UltraWinListView Private Sub ultraListView1_ItemCheckStateChanging(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ItemCheckStateChangingEventArgs) Handles ultraListView1.ItemCheckStateChanging Dim listView As UltraListView = CType(sender, UltraListView) Try ' Disable the ItemCheckStateChanging and ItemCheckStateChanged events, ' so that we don't cause infinite recursion by setting the CheckState ' property in response to this event. listView.EventManager.Disable(UltraListViewEventIds.ItemCheckStateChanging) listView.EventManager.Disable(UltraListViewEventIds.ItemCheckStateChanged) If listView.ShowGroups AndAlso e.NewValue = CheckState.Checked Then Dim group As UltraListViewGroup = e.Item.Group ' Iterate the group's Items collection, and uncheck ' all other items except for this one Dim item As UltraListViewItem For Each item In group.Items If Not item Is e.Item Then item.CheckState = CheckState.Unchecked Next End If Finally ' Re-enable the ItemCheckStateChanging and ItemCheckStateChanged events listView.EventManager.Enable(UltraListViewEventIds.ItemCheckStateChanging) listView.EventManager.Enable(UltraListViewEventIds.ItemCheckStateChanged) End Try End Sub Private Sub ultraListView1_ItemCheckStateChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ItemCheckStateChangedEventArgs) Handles ultraListView1.ItemCheckStateChanged Dim listView As UltraListView = CType(sender, UltraListView) ' Activate and select the item that was checked e.Item.Activate() listView.PerformAction(UltraListViewAction.SelectItem, False, False) End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinListView; using System.Diagnostics; private void ultraListView1_ItemCheckStateChanging(object sender, Infragistics.Win.UltraWinListView.ItemCheckStateChangingEventArgs e) { UltraListView listView = sender as UltraListView; try { // Disable the ItemCheckStateChanging and ItemCheckStateChanged events, // so that we don't cause infinite recursion by setting the CheckState // property in response to this event. listView.EventManager.Disable(UltraListViewEventIds.ItemCheckStateChanging); listView.EventManager.Disable(UltraListViewEventIds.ItemCheckStateChanged); if ( listView.ShowGroups && e.NewValue == CheckState.Checked ) { UltraListViewGroup group = e.Item.Group; // Iterate the group's Items collection, and uncheck // all other items except for this one foreach( UltraListViewItem item in group.Items ) { if ( item != e.Item ) item.CheckState = CheckState.Unchecked; } } } finally { // Re-enable the ItemCheckStateChanging and ItemCheckStateChanged events. listView.EventManager.Enable(UltraListViewEventIds.ItemCheckStateChanging); listView.EventManager.Enable(UltraListViewEventIds.ItemCheckStateChanged); } } private void ultraListView1_ItemCheckStateChanged(object sender, Infragistics.Win.UltraWinListView.ItemCheckStateChangedEventArgs e) { UltraListView listView = sender as UltraListView; // Activate and select the item that was checked e.Item.Activate(); listView.PerformAction( UltraListViewAction.SelectItem, false, false ); }
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