title: Select all check boxes WPF
body: <p>I want to make all check boxes selected by selecting check box names with "All of Above".
  the checkboxes are in a List box</p>
  
  <pre><code>&lt;ListBox SelectionMode="Multiple" 
           BorderThickness="0" 
           ItemsSource="{Binding QuestionThreeSelection}" 
           SelectedItem="{Binding QuestionThreeSelection}" 
           Name="listBoxList" 
           SelectionChanged="listBoxList_SelectionChanged"&gt;
      &lt;ListBox.InputBindings&gt;
          &lt;KeyBinding Command="ApplicationCommands.SelectAll"
                      Modifiers="Ctrl"
                      Key="A" /&gt;
      &lt;/ListBox.InputBindings&gt;
      &lt;ListBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;CheckBox Checked="CheckBox_Checked_1"   
                        Content="{Binding SourceName}" 
                        IsChecked="{Binding Path=IsSelected,  Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>back Code</p>
  
  <pre><code>private void CheckBox_Checked_1(object sender, RoutedEventArgs e)
  {          
      var oo = listBoxList;
      CheckBox cb = (CheckBox)sender;
      //var w=e;
  
      IEnumerable&lt;AddSource&gt; listallityem = ((IEnumerable&lt;AddSource&gt;)listBoxList.Items.SourceCollection).Where(r =&gt; r.IsSelected == false);
      //IEnumerable&lt;AddSource&gt; listallityem1 = ((IEnumerable&lt;AddSource&gt;)listBoxList.Items.SourceCollection);
  
      AddSource vv = cb.DataContext as AddSource;
      if ((bool) cb.IsChecked)
      {
  
      }
  
      if (vv.SourceName== "All of the above")
      {
          r = listBoxList.ItemsSource;
  
          foreach (AddSource item in wer)
          {
              item.IsSelected = true; // false in case of unselect
          }
      }
  }
  </code></pre>
  
  <p>Can someone suggest a method?</p>