title: LookUpEdit not selecting newly entered value when it's a double
body: <p>I have 2 LookUpEdit controls from DevExpress on my form.  Both use an <code>ObservableCollection</code> as it's datasource, one being of type <code>string</code> and the other of type <code>double</code>.  The LookUpEdit control has an event called <code>ProcessNewValue</code> which fires when, you guessed it, a new value is entered in the control.  I've added some code in this event to add the newly added value to the <code>ObservableCollection</code> and it automatically selects it once done.  This works as expected for the <code>string</code> LooUpEdit but when I try it with the <code>double</code> LookUpEdit`, it adds it to the collection but then it clears out the control.</p>
  
  <p>Here's the code to load the controls, which gets called in <code>Form_Load()</code>:</p>
  
  <pre><code>    void InitControls()
      {
          double[] issueNumbers = new double[5];
  
          issueNumbers[0] = 155;
          issueNumbers[1] = 156;
          issueNumbers[2] = 157;
          issueNumbers[3] = 158;
          issueNumbers[4] = 159;
  
          ObservableCollection&lt;double&gt; issues = new ObservableCollection&lt;double&gt;(issueNumbers);
  
          lookupIssues.Properties.DataSource = issues;
          DevExpress.XtraEditors.Controls.LookUpColumnInfoCollection colInfo = lookupIssues.Properties.Columns;
          colInfo.Clear();
          colInfo.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Column"));
          colInfo[0].Caption = "Issue ID's";
  
          string[] stringNumbers = Array.ConvertAll&lt;double, string&gt;(issueNumbers, Convert.ToString);
          ObservableCollection&lt;string&gt; issuesString = new ObservableCollection&lt;string&gt;(stringNumbers);
  
          lookupStringValue.Properties.DataSource = issuesString;
          colInfo.Clear();
          colInfo.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Column"));
          colInfo[0].Caption = "String Issue ID's";
  
      }
  </code></pre>
  
  <p>And here's the ProcessNewValue event for both (I've renamed them to try to make it easier to see which does what):</p>
  
  <pre><code>    private void OnProcessNewValue_Double(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
      {
          ObservableCollection&lt;double&gt; source = (ObservableCollection&lt;double&gt;)(sender as LookUpEdit).Properties.DataSource;
  
          if (source != null)
          {
              if ((sender as LookUpEdit).Text.Length &gt; 0)
              {
                  source.Add(Convert.ToDouble((sender as LookUpEdit).Text));
                  (sender as LookUpEdit).Refresh();
              }
          }
  
          e.Handled = true;
      }
  
      private void OnProcessNewValue_String(object sender, DevExpress.XtraEditors.Controls.ProcessNewValueEventArgs e)
      {
          ObservableCollection&lt;string&gt; source = (ObservableCollection&lt;string&gt;)(sender as LookUpEdit).Properties.DataSource;
  
          if (source != null)
          {
              if ((sender as LookUpEdit).Text.Length &gt; 0)
              {
                  source.Add((sender as LookUpEdit).Text);
                  (sender as LookUpEdit).Refresh();
              }
          }
  
          e.Handled = true;
      }
  </code></pre>
  
  <p>As you can see, the code it identical with the exception of one converting text to a double before adding it to the collection.</p>
  
  <p>Anyone know why the double value gets added to the collection but the control doesn't automatically select it like it does with a string collection?  I've even tried to hard-code the newly added value right after <code>e.Handled = true;</code> but it still doesn't select it.  What's weird is that if I run it through the debugger, I can step through and see that the <code>lookupIssues</code> control indeed gets the newly added value AND it's <code>Text</code> property is set to it, but as soon as the event terminates, the control clears it out.....really strange.</p>
  
  <p>Any help is greatly appreciated!</p>
  
  <p>BTW, I can add a link to a sample project that duplicates the problem but you would need to have DevExpress v12.2.6 controls installed in order to compile the project.</p>