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
495
Set background button in disabled combobox
posted

We have a control which adds 2 buttons to a combobox. Works splendid.

Now, when we disable the combobox we have to set the DisabledBackColor and DisabledForeColor to Black and White. Works also very good...

BUT the background of the 2 buttons are after disabling grey. See attachment. 

Is there anyway we can set this background to white or maybe make the buttons invisible ?

The combo is disabled AFTER the combo is initialized so I cannot make the buttons invisible when I add them to the combo...

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    Just like the Combo, the buttons in the ButtonsRight collection have an appearance (which is how you are getting your image in there). So you could do the same thing you are doing for the combo - set a DisabledBackcolor and DisabledForeColor on each button. 

    There is no way to hide a button in the ButtonsRight collection. But you could handle the EnabledChanged event of the combo and remove those buttons when the control is disabled and then re-add them when it is enabled.

    Another option would be to use a CreationFilter to remove the UIElements for those buttons, but this would be a bit more complex, especially if you are not familiar with CreationFilters.

Children