How to chang color of ToolTabStrip in RadDock?

4 posts, 0 answers
  1. Anol
    Anol avatar
    12 posts
    Member since:
    Dec 2007

    Posted 19 Aug 2009 Link to this post

    Hi. everyone.
        I can change color of ToolTabStrip in RadDock.
     But when it colapse, why it change to default color.
    if anyone have ideas.please suggest me.

    ToolWindow toolWindow = new ToolWindow("Menu");  
    toolWindow.BackColor = Color.Transparent;  
    this.dockWorkField.DockWindow(toolWindow, DockPosition.Left);  
    //Change tooltabstrip color  
    ToolTabStrip toolTab = (ToolTabStrip)toolWindow.Parent;  
    toolTab.BackColor = Color.Transparent;  
    toolTab.RootElement.Shape = this.roundRectShape;  
    toolTab.Padding = new Padding(3);  
    ((FillPrimitive)(toolTab.RootElement.Children[0].Children[0].Children[0])).GradientStyle = Telerik.WinControls.GradientStyles.Solid;  
    ((FillPrimitive)(toolTab.RootElement.Children[0].Children[0].Children[0])).BackColor = Color.FromArgb(219, 198, 201);  
    ((FillPrimitive)(toolTab.RootElement.Children[0].Children[0].Children[0])).Shape = this.roundRectShapeTop;  
    ((BorderPrimitive)(toolTab.RootElement.Children[0].Children[0].Children[1])).Shape = this.roundRectShapeTop;  
    //Change splitter color  
    FillPrimitive FillElement = (FillPrimitive)this.dockWorkField.RootElement.Children[1].Children[0].Children[0];  
    FillElement.BackColor = Color.Transparent;  
    FillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;  

    Best regard
    Anol Paisal
  2. Boryana
    Boryana avatar
    330 posts

    Posted 21 Aug 2009 Link to this post

    Hi Anol,

    Thank you for contacting us. Unfortunately, at the moment there is no way to set the BackColor of the ToolWindowCaption at run time. This issue will be addressed in the future releases. The only way to customize the appearance of RadDock is through themes. Since RadDock is a new control, it is not supported in Visual Style Builder yet. At the same time our team did not managed to prepare help articles to show how to customize the themes for RadDock. The only approach for creating a new theme is modifying the xml file of an already created theme. So it seems that creating a theme for RadDock is not an easy task. We apologize for the inconvenience. Our team will provide mechanism for easy customizing themes for RadDock in near future.
    Nevertheless, I have prepared for you a sample project that applies the Sapphire theme for the RadDock control. It demonstrates how to incorporate xml files in your application and how to apply the theme to your RadDock. Please, note that I have set the BackColor of the ToolWindowCaption TitleFill, so now the ToolWindow will be always painted in the color (219, 198, 201).

    I hope this is helpful. If you have further questions, do not hesitate to contact me back.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft R3 2016 release webinar banner
  4. Tzhai Gal
    Tzhai Gal avatar
    2 posts
    Member since:
    Nov 2009

    Posted 03 Feb 2010 Link to this post

    I think i have some solution for more than the Colors.
    With this code i can keep all  the parameters as i designed, like:  Image, backColors, SplitterBackColor, ForColor, RightToLeft , Fonts,  the 4 BackColors, BorderBackColor... etc as you can see.
    I am sure that telerik Group can make the code look better and work even better.
    But , i have a problem, this code dos not work if i click on the hide button .(it's Collapse) .
    Please help me with this.

            this.radDock1.TransactionCommitted += radDock1_TransactionCommitted;
     radDock1_TransactionCommitted(object sender, RadDockTransactionEventArgs e)  
                radDock1.BackColor = Color.FromArgb(179, 179, 179);  
                foreach (DockWindow window in e.Transaction.AssociatedWindows)  
                    if (window.DockTabStrip != null)  
                            window.DockTabStrip.Font = new Font("Arial", 11.25F, FontStyle.Bold);  
                            window.DockTabStrip.BackColor = Color.FromArgb(242, 242, 242);  
                            window.DockTabStrip.RightToLeft = RightToLeft.Yes;  
                            window.DockTabStrip.TabStripAlignment = TabStripAlignment.Top;  
                            if (window.DockTabStrip.SplitContainer != null)  
                                window.DockTabStrip.SplitContainer.BackColor = Color.FromArgb(179, 179, 179);  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor  = Color.FromArgb(111, 171, 231);  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor2 = Color.FromArgb(65,132,200);  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor3 = Color.FromArgb(45,109,173);  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor4 = Color.FromArgb(79,140,197);  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).GradientPercentage  = 0.6F;  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).GradientPercentage2 = 0.4F;  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(0))).AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;  
                            ((RadToggleButtonElement)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(1))).ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;  
                            ((RadToggleButtonElement)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(1))).Image   = global::Sample1.Properties.Resources.pushpin_vertical;  
                            ((RadToggleButtonElement)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(1))).Padding = new Padding(0, 1, 3, 1);  
                            ((RadToggleButtonElement)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(1))).Margin  = new Padding(0, 0, 2, 0);  
                            ((RadToggleButtonElement)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(1))).MinSize = new Size(7, 7);  
                            ((FillPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(1).GetChildAt(0))).BackColor = Color.FromArgb( 0, 255, 255, 255 );  
                            ((TextPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(3))).StretchHorizontally = true;  
                            ((TextPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(3))).StretchVertically   = true;  
                            ((TextPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(3))).ForeColor = Color.FromArgb(255, 255, 255);  
                            ((TextPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(3))).Font = new Font("Arial", 11.25F, FontStyle.Bold );//, System.Drawing.GraphicsUnit.Point, ((byte)(177)));  
                            ((TextPrimitive)(window.DockTabStrip.GetChildAt(0).GetChildAt(0).GetChildAt(2).GetChildAt(3))).Margin = new Padding(0, 0, 5, 0);  
                            ((BorderPrimitive)(window.DockTabStrip.GetChildAt(1))).ForeColor = Color.FromArgb(68, 128, 190 );  
                        catch(Exception ex)  
                                ((BorderPrimitive)(window.DockTabStrip.GetChildAt(0))).ForeColor = Color.FromArgb(68, 128, 190);  
                            catch (Exception ex2)  
                        //foreach (RadElement c in window.TabStripItem.Children)  
                        //    RadMessageBox.Show(c.ToString());  
    Ofer Hadad
  5. Nikolay
    Nikolay avatar
    1802 posts

    Posted 08 Feb 2010 Link to this post

    Hi Tzhai Gal,

    The custom colors are not applied to the titlebar part of the DockTabStrip, because when a ToolWindow is in AutoHide mode, it is hosted by an AutoHideTabStrip, but not by a ToolTabStrip. However, your code concerns the strcture of ToolTabStrip only. It would be better if you set the desired colors using the CaptionElement property:
    FillPrimitive fill = (FillPrimitive)((ToolTabStrip)window.DockTabStrip).CaptionElement.Children[0];
    fill.BackColor = Color.FromArgb(111, 171, 231);
    fill.BackColor2 = Color.FromArgb(65, 132, 200);
    fill.BackColor3 = Color.FromArgb(45, 109, 173);
    fill.BackColor4 = Color.FromArgb(79, 140, 197);
    fill.GradientPercentage = 0.6F;
    fill.GradientPercentage2 = 0.4F;

    In Q1 2010 we will introduce a new Visual Style Builder that will support the RadDock control. For additional information about this tool, please refer to the following blog post: Expression Blend for WinForms? We are almost there!

    I hope this helps. If you have additional questions, feel free to contact me.

    Best wishes,
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top