The problem has come about from a requirement to do list item filtering in a RadComboBox; the principle of which is as follows: The RadComboBox is text-editable such that a user may move their carat into the text field portion of the combo box and start to type. As the user types, the list of RadComboBoxItems in its Items collection will update to reflect values appropriate with the user’s input text.
This portion works correctly and a user can type into the box and have the Items collection of the combo box update from the RadComboBox’s TextChanged event. In the code that handle’s this event, all values passed into the event as well as the instantiated RadComboBox and its associated Items collection are traversable and correct. It needs to be stated, however, that this TextChanged event fires twice; first with the correct data being send to the event handler and then, immediately thereafter, a second time with a bunce of blank Strings and null values being passed through. We have coded around this double event firing.
However, a second event is also required that will cater for the user actually making a selection from the list of RadComboBoxItems that are available at the time and such a selection will be made through mouse action on the drop down list presented to them.
We have unsuccessfully attempted to use both the exposed SelectedValueChanged event and the SelectedIndexChanged event handlers for these controls and in both situations the scenario is the same. No matter what is done, the earlier TextChanged event fires (twice, once with garbage) before the SelectedValueChanged event fires. Stepping through the code shows some interesting behaviour in the way in which the event synchronicity is handled; the first TextChanged event fires and executes until a call to a separate method is required, at which point the second event propagates and starts processing. After the second TextChanged event is processed the SelectedValueChanged event is fired (again, twice) and that event will complete execution before the first TextChanges event un-pauses and finally completes.
The problem thus is as follows: TextChanged is an event that is used to rebuild the Items collection and SelectedIndexChanged is an event that is used to populate the rest of the form based on the user’s choice. Simply put, the TextChanges event firing before a SelectedIndexChanged event is causing the collection to be rebuilt and thus causing the RadComboBox control to lose its state and the ever important SelectedValue property that we hope to retrieve there.