'宣言 Public Event ItemCheckStateChanged As ItemCheckStateChangedEventHandler
public event ItemCheckStateChangedEventHandler ItemCheckStateChanged
イベント ハンドラが、このイベントに関連するデータを含む、ItemCheckStateChangedEventArgs 型の引数を受け取りました。次の ItemCheckStateChangedEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
Item Infragistics.Win.UltraWinListView.ItemEventArgsから継承されます。 |
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 ); }