title: How to remove checked items from a listbox in WPF?
body: <p>I have been working on a checklist application, and I am using a <code>ListBox</code> to display the data.
  I am using arrays to populate the <code>ListBox</code> based on what button the user presses. 
  (I don't know if that's best practice but it works for now.)  Once the user has completed the steps, he can remove the items with this command:</p>
  
  <pre><code>private void SendSelected()
  {
      while (lstToDo.SelectedItems.Count &gt; 0)
      {
          lstToDo.Items.Remove(lstToDo.SelectedItem);
      }
  }
  </code></pre>
  
  <p>The problem is that today I have learned how to add <code>CheckBox</code>es to my <code>ItemTemplate</code> with the xaml below:</p>
  
  <pre><code>&lt;ListBox.ItemTemplate&gt;
      &lt;DataTemplate&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;CheckBox Padding="10"&gt;                            
                  &lt;CheckBox.LayoutTransform&gt;
                      &lt;ScaleTransform ScaleX="1" ScaleY="1" /&gt;
                  &lt;/CheckBox.LayoutTransform&gt;
              &lt;/CheckBox&gt;
              &lt;TextBlock Text="{Binding}"/&gt;
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/ListBox.ItemTemplate&gt;
  </code></pre>
  
  <p>Now the remove button still works... however I would like to adjust it so that it removes the checked items instead of selected items.
  In winforms, I used to do it like this:</p>
  
  <pre><code>while (lstToDo.CheckedItems.Count &gt; 0)
  {
      lstToDo.Items.Remove(lstToDo.CheckedItems[0]);
  }  
  </code></pre>
  
  <p>But in WPF, obviously this method doesn't work, and I am just not sure why.</p>