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
4028
How to run code as soon as a combo option is selected
posted

This post is kind of similar to a previous posting (http://forums.infragistics.com/forums/p/3391/19040.aspx), which was about UltraDropDowns, and was never 100% answered.

 Anyway, what I want is to be able to run some code as soon as the user selects an option in the UltraCombo. I have tried a few events, none of which are quite there:

AfterCloseUp - Fires no matter how the combo is closed up, by selecting an option, or just by closing it without selecting an option.

RowSelected - Fires every time the user moves from row to row within the combo, no matter if they selected an option or not.

ValueChanged - Fires as the user is typing an option in (when auto-complete kicks in).

AfterCloseUp looks like it would be the perfect place, if only I had a way of knowing if it was closed up because the user selected an option or if the user just closed it without selecting anything.

Anyone have any ideas? 

Parents
No Data
Reply
  • 71886
    Offline posted

    Hello fweeee,

    You are right - you could use the 'AfterCloseUp' event. You could check in it if the left mouse button is clicked and if this was done on a cell in the WinCombo control.

    Below is a my code sample:

     

    private void ultraCombo1_AfterCloseUp(object sender, EventArgs e)
            {
                if (mouseCaptured .Button == MouseButtons.Left &&
                    ((Infragistics.Win.ControlUIElementBase)(ultraCombo1.DisplayLayout.UIElement)).LastElementEntered != null &&
                    ((Infragistics.Win.ControlUIElementBase)(ultraCombo1.DisplayLayout.UIElement)).LastElementEntered.GetType() == typeof(EditorWithTextDisplayTextUIElement))
                {
                    //Your code here...
                }
                
            }
    
            MouseEventArgs mouseCaptured;
            private void ultraCombo1_MouseClick(object sender, MouseEventArgs e)
            {
                mouseCaptured = e;
            }
    

     Please review the above code and feel free to let me know if I misunderstood you or if you have any other questions.

Children