title: Check checkboxes in combobox
body: <p>I have a combobox which has checkbox as its combobox.itemtemplate.</p>
  
  <pre><code>&lt;ComboBox Name="comboBoxTest" 
                            SelectedValuePath="Test" 
                            SelectedItem="{Binding SelectedTest, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            SelectedValue="{Binding SelectedTest, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            ItemsSource="{Binding Test, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                            TextBoxBase.TextChanged ="comboBoxTest_TextChanged" Grid.ColumnSpan="2"
                            TextSearch.TextPath="Model" &gt;
                      &lt;ComboBox.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;CheckBox Name="checkBoxTest"
                                        Content="{Binding Test}"
                                        Click="checkBoxTest_Click"/&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/ComboBox.ItemTemplate&gt;
                  &lt;/ComboBox&gt;
  </code></pre>
  
  <p>An “--Select All--” item has been add into the result list when the result list is produced.
  <img src="https://i.stack.imgur.com/QCFbm.png" alt="combobox with checkbox"></p>
  
  <p>When user checks on the “All” item, the other checkboxes should be checked as well.
  I am using the codes below but it doesn’t work.</p>
  
  <pre><code>if (checkBoxTest.Content.ToString().Equals("--Select All--"))
  {
       foreach (object item in comboBoxTest.Items)
       {
           ComboBoxItem comboBoxItem = comboBoxTest.ItemContainerGenerator.ContainerFromItem(item) as ComboBoxItem;
            FrameworkElement element = comboBoxItem.ContentTemplate.LoadContent() as FrameworkElement;
            CheckBox checkBox = element.FindName("checkBoxTest") as CheckBox;
            checkBox.IsChecked = true;
        }
   }
  </code></pre>