Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
Is there an event that...
posted

I would like to respond to ValueChanged, except I don't want to respond to it when the user is typing in the combo and the combo is autocompleting.  So basically, I'd like to do something when the user opens the combo and makes a selection with the mouse or if they open the combo, use the arrow keys and then press <enter>.  I DON'T want to react if the dropdown is open, but the user is typing into the textbox portion and the control is autocompleting.

 Is there an event or property I can use to make this easier?

Parents
No Data
Reply
  • 69832
    Offline posted

    I'm not certain that I followed this, but the control exposes an 'IsDroppedDown' property, so you can use that to know whether the dropdown is open. When the character typed by the end user causes a match to be made, i.e., the control auto-completes the value, the control's SelectedRow property will be non-null when the typed character was auto-completed.

    Example:
    void OnValueChanged(object sender, EventArgs e)
    {
        UltraCombo ultraCombo = sender as UltraCombo;
        bool wasAutoCompleted = ultraCombo != null &&
                                ultraCombo.IsDroppedDown == false &&
                                ultraCombo.SelectedRow != null;
    }

    Note that this is not airtightyet, as it doesn't catch the condition whereby the up/down arrow key was used to change the value, but you could probably hack around that by handling KeyDown, KeyPress, etc. If I missed the point here please repost and we will try to help.

Children