title: Wpf CheckedListbox - how to get selected item
body: <p>I've made a CheckedListbox in xaml using this code:</p>
  
  <pre><code>                    &lt;ListBox Height="340" ItemsSource="{Binding Sections}" SelectedItem="{Binding SelectedSection}"&gt;
                      &lt;ListBox.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;CheckBox IsChecked="{Binding IsChecked}" Content="{Binding Path=Item}" /&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/ListBox.ItemTemplate&gt;
                  &lt;/ListBox&gt;
  </code></pre>
  
  <p>And its bind to this collection:</p>
  
  <pre><code>public ObservableCollection&lt;CheckedListItem&lt;String&gt;&gt; Sections { get; set; }
  private CheckedListItem&lt;String&gt; _selectedSection;
  public CheckedListItem&lt;String&gt; SelectedSection
      {
          get { return _selectedSection; }
          set 
          {
              _selectedSection = value; 
              RaisePropertyChanged("SelectedSection"); 
          }
      }
  </code></pre>
  
  <p>The CheckedListItem class looks like this:</p>
  
  <pre><code>    public class CheckedListItem&lt;T&gt; : INotifyPropertyChanged
      {
      public event PropertyChangedEventHandler PropertyChanged;
  
      private bool isChecked;
      private T item;
  
      public CheckedListItem()
      { }
  
      public CheckedListItem(T item, bool isChecked = false)
      {
          this.item = item;
          this.isChecked = isChecked;
      }
  
      public T Item
      {
          get { return item; }
          set
          {
              item = value;
              if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Item"));
          }
      }
  
  
      public bool IsChecked
      {
          get { return isChecked; }
          set
          {
              isChecked = value;
              if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("IsChecked"));
          }
      }
  }
  </code></pre>
  
  <p>I tried to set a breakpoint in the _selectedSection = value; part of the code but it never gets triggered when i select/deselect an item in the CheckedListBox.</p>
  
  <p>My question is how can I get the selected item every time its selected/deselected ?</p>
  
  <p>Thanks</p>