title: DataGridViewComboBoxColumn - value lags for a split second
body: <p>I have a DataGridView with a few DataGridViewComboBoxColumns. There is a CellEnter event handler on the DataGridView for the purpose of single-click dropping down of the comboboxes.</p>
  
  <p>The column is bound to a List of KeyValuePairs, ValueMember being "Key", and DisplayMember being "Value".</p>
  
  <p>When I click on a combobox column, it works fine. However, if the cell is in the "dropdown" state and I click on another combobox (same column, different row), it properly deselects the old cell, selects and drops down the new cell, however the selected value on top changes to the value from the old cell for a split second, before changing back to the correct one.</p>
  
  <p>For example, let's say the list is A, B, C. In row1, A is selected, in row2, B is selected. I click the cell in row1, all is as it should be. Then, while this cell is dropped down, I click on the cell in row2. It drops down properly, but the selected value on top becomes A, then switches back to B (the correct one) immediately.</p>
  
  <p>If I click on a cell in some other column before clicking the second combobox cell, this doesn't happen.</p>
  
  <p>Is there a way to prevent this from happening?</p>
  
  <p>Example code to reproduce the problem (the event handlers are hooked up to the obvious events):</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace PDGV
  {
      public partial class Form1 : Form
      {
          List&lt;KeyValuePair&lt;string, string&gt;&gt; bindingList = new List&lt;KeyValuePair&lt;string, string&gt;&gt;();
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              dataGridView1.Rows.Add(10);
              bindingList.Add(new KeyValuePair&lt;string,string&gt;("aaa", "111"));
              bindingList.Add(new KeyValuePair&lt;string,string&gt;("bbb", "222"));
              bindingList.Add(new KeyValuePair&lt;string,string&gt;("ccc", "333"));
              bindingList.Add(new KeyValuePair&lt;string,string&gt;("ddd", "444"));
              bindingList.Add(new KeyValuePair&lt;string,string&gt;("eee", "555"));
              BindComboList(2, bindingList);
  
          }
  
          private void BindComboList(int columnIndex, object list)
          {
              var column = dataGridView1.Columns[columnIndex] as DataGridViewComboBoxColumn;
              if (column != null)
              {
                  column.DataSource = new BindingSource(list, null);
                  column.DisplayMember = "Value";
                  column.ValueMember = "Key";
              }
          }
  
          private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
          {
              if (e.RowIndex == -1)
                  return;
  
              dataGridView1.BeginEdit(true);
              var control = dataGridView1.EditingControl as DataGridViewComboBoxEditingControl;
              if (control != null)
                  control.DroppedDown = true;
          }
      }
  }
  </code></pre>