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
410
How? : Make a Combo update its bindings after the user picks
posted

Right now my combo will not update its bound object until it goes through the whole lost focus routines...in other words I have to move to the next control before the property is changed...

Ideally the control would update the bound property and then andvance to the next control as if the user had tabbed ahead...

I messed around with the value changed event and used the Parent.SelectNextControl...but that bypasses the validation and binding update... 

Also...is there anyway at all to stop the combo from showing the text as selected when it has the focus? The combo is set up as a drop down list...and I would like to control not only the text in the editor box, but also the list items...

There appears to be now appearance for "SelectedText"... 

 CW

  • 469350
    Offline posted

    Hi Carson,

    I'm having trouble following you. 

    CarsonWales said:

    Right now my combo will not update its bound object until it goes through the whole lost focus routines...in other words I have to move to the next control before the property is changed...

    Ideally the control would update the bound property and then andvance to the next control as if the user had tabbed ahead...

    I messed around with the value changed event and used the Parent.SelectNextControl...but that bypasses the validation and binding update... 

    What exactly do you mean by this? What property of the combo are you binding? When exactly are you checking the value of that property or the value of the field in the data source? What event are you using?

    The way binding work in DotNet, we really don't have a lot of control over when the underlying value in the data source is set. The control simply fires an event that indicates that the property has changed and the BindingManager in DotNet does the rest. So if you are binding the Value property, then all the control does is fire the ValueChanged event.

    If you need to force the value to be written ealier, then perhaps you should not use DataBinding and instead write the value to the data source in code.

    Also, I don't see how caling SelectNextControl could be any different than pressing the Tab key and moving to the next control. 

    CarsonWales said:

    Also...is there anyway at all to stop the combo from showing the text as selected when it has the focus? The combo is set up as a drop down list...and I would like to control not only the text in the editor box, but also the list items...

    There appears to be now appearance for "SelectedText"... 

    If the combo is in DropDownList mode, then there is never any selected text. The entire text area will appear highlighted when you select a value, but this is the same behavior as the inbox ComboBox control.