CommandBarToggleButton appearance when disabled

1 posts, 0 answers
  1. Chris Vaughn
    Chris Vaughn avatar
    2 posts
    Member since:
    Feb 2010

    Posted 19 Feb 2016 Link to this post

    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!




Back to Top