バージョン

ItemSelectionChanged イベント

シンタックス
'宣言
 
Public Event ItemSelectionChanged As ItemSelectionChangedEventHandler
public event ItemSelectionChangedEventHandler ItemSelectionChanged
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、ItemSelectionChangedEventArgs 型の引数を受け取りました。次の ItemSelectionChangedEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
SelectedItems  
使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView


    Private Sub ultraListView1_ItemSelectionChanging(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ItemSelectionChangingEventArgs) Handles ultraListView1.ItemSelectionChanging

        '	Get a reference to the UltraListView control
        Dim listView As UltraListView = CType(sender, UltraListView)

        '	Get a reference to the last member of the SelectedItems
        '	collection...note that it does not matter which member we use,
        '	we just need any currently selected item
        Dim previousSelectedItem As UltraListViewItem = listView.SelectedItems.Last

        '	Iterate the SelectedItems collection passed through the
        '	event arguments this represents what the contents of the
        '	UltraListView's SelectedItems collection will become if this
        '	event is not canceled.
        If listView.ShowGroups AndAlso Not previousSelectedItem Is Nothing Then

            Dim selectedItem As UltraListViewItem
            For Each selectedItem In e.SelectedItems

                '	If any member of the new SelectedItems collection is
                '	in a different group than the currently selected items,
                '	cancel the event.
                If Not selectedItem.Group Is previousSelectedItem.Group AndAlso _
                    Not e.SelectedItems.First Is e.SelectedItems.Last Then
                    e.Cancel = True
                    Return
                End If
            Next
        End If
    End Sub

    Private Sub ultraListView1_ItemSelectionChanged(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ItemSelectionChangedEventArgs) Handles ultraListView1.ItemSelectionChanged

        '	Get a reference to the UltraListView control
        Dim listView As UltraListView = CType(sender, UltraListView)

        '	Apply a different appearance based on whether multiple items are selected
        If (e.SelectedItems.Count > 1) Then

            listView.ItemSettings.SelectedAppearance.BackColor = Color.LightBlue
            listView.ItemSettings.SelectedAppearance.BackColor2 = SystemColors.Highlight
            listView.ItemSettings.SelectedAppearance.BackGradientStyle = GradientStyle.Vertical
        Else
            listView.ItemSettings.SelectedAppearance.Reset()
        End If
    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using System.Diagnostics;


		private void ultraListView1_ItemSelectionChanging(object sender, Infragistics.Win.UltraWinListView.ItemSelectionChangingEventArgs e)
		{
			//	Get a reference to the UltraListView control
			UltraListView listView = sender as UltraListView;

			//	Get a reference to the last member of the SelectedItems
			//	collection...note that it does not matter which member we use,
			//	we just need any currently selected item
			UltraListViewItem previousSelectedItem = listView.SelectedItems.Last;

			//	Iterate the SelectedItems collection passed through the
			//	event arguments; this represents what the contents of the
			//	UltraListView's SelectedItems collection will become if this
			//	event is not canceled.
			if ( listView.ShowGroups && previousSelectedItem != null )
			{
				foreach( UltraListViewItem selectedItem in e.SelectedItems )
				{
					//	If any member of the new SelectedItems collection is
					//	in a different group than the currently selected items,
					//	cancel the event.
					if ( selectedItem.Group != previousSelectedItem.Group &&
						 e.SelectedItems.First != e.SelectedItems.Last )
					{
						e.Cancel = true;
						break;
					}
				}
			}
		}

		private void ultraListView1_ItemSelectionChanged(object sender, Infragistics.Win.UltraWinListView.ItemSelectionChangedEventArgs e)
		{
			//	Get a reference to the UltraListView control
			UltraListView listView = sender as UltraListView;

			//	Apply a different appearance based on whether multiple items are selected
			if ( e.SelectedItems.Count > 1 )
			{
				listView.ItemSettings.SelectedAppearance.BackColor = Color.LightBlue;
				listView.ItemSettings.SelectedAppearance.BackColor2 = SystemColors.Highlight;
				listView.ItemSettings.SelectedAppearance.BackGradientStyle = GradientStyle.Vertical;
			}
			else
				listView.ItemSettings.SelectedAppearance.Reset();
		}
参照