This is a migrated thread and some comments may be shown as answers.

CommandBarToggleButton appearance when disabled

0 Answers 133 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Chris Vaughn
Top achievements
Rank 1
Chris Vaughn asked on 19 Feb 2016, 04:21 PM

I'm posting this for anyone who comes across this same issue.

As of Q1 2015 SP1, the CommandBarToggleButton has been changed with respect to how it behaves when disabled. If you want toggle buttons to look the same as regular buttons when disabled, you need to set the UseDefaultDisabledPaint property to true and also handle the EnabledChanged event to turn off or on the DrawBorder and DrawFill properties.

        private void toggleSelectMode_EnabledChanged(object sender, EventArgs e)
        {
            ((Telerik.WinControls.UI.CommandBarToggleButton)sender).DrawBorder = ((Telerik.WinControls.UI.CommandBarToggleButton)sender).Enabled;
            ((Telerik.WinControls.UI.CommandBarToggleButton)sender).DrawFill = ((Telerik.WinControls.UI.CommandBarToggleButton)sender).Enabled;
        }

Without these steps, when you disable a toggle button you'll see one or all of the following

  • the buttons stay in color (not grayed out) 
  • the border of the button visible
  • the background of the button go gray instead of just the icon

In the attached image, all of the command bar buttons have Enabled set to false. The controls look as expected except for the toggle buttons. If you follow the steps given in this post, they'll look as expected too.

Good luck all!

Chris

 

 

No answers yet. Maybe you can help?

Tags
CommandBar
Asked by
Chris Vaughn
Top achievements
Rank 1
Share this question
or