WPF C#

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="CheckBoxList" Height="300" Width="300">
  
    
      
      
    

    
    
      Option 1
      Option 2
      Option 3
    
    
      Examine All Items
    
  

//File:Window.xaml.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ClassicControls
{
    public partial class CheckBoxList : System.Windows.Window
    {
        public CheckBoxList()
        {
            InitializeComponent();
        }
        private void lst_SelectionChanged(object sender, RoutedEventArgs e)
        {
            if (e.OriginalSource is CheckBox)
            {
                lst.SelectedItem = e.OriginalSource;
            }
            
            if (lst.SelectedItem == null) return;
            Console.WriteLine(lst.SelectedIndex);
            Console.WriteLine(((CheckBox)lst.SelectedItem).IsChecked);
        }
        private void cmd_CheckAllItems(object sender, RoutedEventArgs e)
        {
            foreach (CheckBox item in lst.Items)
            {
                if (item.IsChecked == true)
                {
                    Console.WriteLine((item.Content + " is checked."));
                }
            }
        }
    }
}