//File:Window.xaml.vb Imports System Imports System.Collections.Generic Imports System.Text Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Data Imports System.Windows.Documents Imports System.Windows.Input Imports System.Windows.Media Imports System.Windows.Media.Imaging Imports System.Windows.Shapes Namespace ClassicControls Public Partial Class CheckBoxList Inherits System.Windows.Window Public Sub New() InitializeComponent() End Sub Private Sub lst_SelectionChanged(sender As Object, e As RoutedEventArgs) If TypeOf e.OriginalSource Is CheckBox Then lst.SelectedItem = e.OriginalSource End If If lst.SelectedItem Is Nothing Then Return End If Console.WriteLine(lst.SelectedIndex) Console.WriteLine(DirectCast(lst.SelectedItem, CheckBox).IsChecked) End Sub Private Sub cmd_CheckAllItems(sender As Object, e As RoutedEventArgs) For Each item As CheckBox In lst.Items If item.IsChecked = True Then Console.WriteLine((Convert.ToString(item.Content) & " is checked.")) End If Next End Sub End Class End Namespace