Title forecolor of RadRibbonForm does not change to white on focus.

2 Answers 108 Views
RibbonForm
Robert
Top achievements
Rank 1
Iron
Robert asked on 12 Sep 2022, 04:51 PM

Hello,

I can't seem to find a way to change the title forecolor on the RadRibbonForm to white on focus. The control buttons change to white but not the title. When the form is not in focus then the background changes to white and the text and controls are black. But when form is focused the background changes to dark blue and the text remains black.

I know I can change  AllowAero to false to control colors on the title bar. However, making that change also seems to make it more difficult to grab the edges of the form for resizing. I am also using the Fluent theme. But I've tried with other themes to no avail. 

Robert

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 13 Sep 2022, 08:59 AM

Hi Robert,

Thank you for the provided image.

You can use this.RibbonBar.RibbonBarElement.RibbonCaption.ForeColor to change the color of the Text when the AllowAero is set to False. You can subscribe to the Activated and Deactivate events where you can check the ForeColor property. However, as you mentioned, you could not resize the Form as per your requirement. In this case, you can increase the border by creating a custom RadRibbonFormBehavior. Then you can override the BorderWidth property and set your desired size.

public partial class RadRibbonForm1 : Telerik.WinControls.UI.RadRibbonForm
{
    public RadRibbonForm1()
    {
        InitializeComponent();
        new RadControlSpyForm().Show();
        this.AllowAero = false;

        this.Activated += RadRibbonForm1_Activated;
        this.Deactivate += RadRibbonForm1_Deactivate;
           
           
    }
    protected override FormControlBehavior InitializeFormBehavior()
    {
        return new MyFormBehavior(this);
    }

    private class MyFormBehavior : RadRibbonFormBehavior
    {
        public MyFormBehavior(IComponentTreeHandler treeHandler)
            : base(treeHandler, true)
        {
        }
        public override Padding BorderWidth 
        {
            get 
            { return new Padding(3); }
        }
    }     

    private void RadRibbonForm1_Deactivate(object sender, EventArgs e)
    {
        this.RibbonBar.RibbonBarElement.RibbonCaption.ForeColor = Color.Black;
    }

    private void RadRibbonForm1_Activated(object sender, EventArgs e)
    {
        this.RibbonBar.RibbonBarElement.RibbonCaption.ForeColor = Color.Red;
    }
}

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Robert
Top achievements
Rank 1
Iron
answered on 15 Sep 2022, 11:52 AM
Thanks, Dinko. That works perfectly.
Tags
RibbonForm
Asked by
Robert
Top achievements
Rank 1
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Robert
Top achievements
Rank 1
Iron
Share this question
or