title: How do I make the combobox close when the dropdown button is pressed a second time?
body: <p>I have a wpf combobox with some custom items. When the dropdown button is clicked the second time I would like the dropdown to close but instead it is reopened. I've seen similar issues in other applications and I've looked for a solution online but without succes. Here's the code so far:</p>
  
  <pre><code>        &lt;ComboBox Name="ComboBoxColorLut"
                    IsEditable="False"
                    SelectionChanged="ComboBoxColorLut_SelectionChanged"                       
                    ToolTip="Color lookup table"
                    HorizontalContentAlignment="Stretch"&gt;
                      &lt;ComboBox.ItemContainerStyle&gt;
                          &lt;Style TargetType="{x:Type ComboBoxItem}"&gt;
                              &lt;Setter Property="HorizontalContentAlignment" Value="Stretch"/&gt;
                  &lt;/Style&gt;
              &lt;/ComboBox.ItemContainerStyle&gt;
              &lt;ComboBox.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Grid&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition &gt;&lt;/RowDefinition&gt;
                              &lt;RowDefinition Height="3"&gt;&lt;/RowDefinition&gt;
                          &lt;/Grid.RowDefinitions&gt;
                          &lt;TextBlock Grid.Row="0" Text="{Binding Path=Name}"&gt;&lt;/TextBlock&gt;
                          &lt;Rectangle Grid.Row="1" Fill="{Binding LinearGradientBrush}"&gt;&lt;/Rectangle&gt;
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ComboBox.ItemTemplate&gt;
          &lt;/ComboBox&gt;
  </code></pre>