Can I change the color of the tab on RadPageView?

5 posts, 1 answers
  1. Pavel
    Pavel avatar
    21 posts
    Member since:
    Sep 2016

    Posted 07 Nov Link to this post

    I want to be able to distinguish between different tabs using color. How can I change the tabs to look something like this?
  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 08 Nov Link to this post

    Hi Pavel,

    Thank you for writing.

    The following snippet shows how to access the items and set their BackColor:
    private void radButton1_Click(object sender, EventArgs e)
    {
        RadPageViewStripElement stripElement = (RadPageViewStripElement)this.radPageView1.ViewElement;
        
        stripElement.Items[0].DrawFill = true;
        stripElement.Items[0].BackColor = Color.Red;
        stripElement.Items[0].GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Pavel
    Pavel avatar
    21 posts
    Member since:
    Sep 2016

    Posted 08 Nov in reply to Dimitar Link to this post

    This worked well, but only when the tab is active. When inactive, it's just showing up up a square and doesn't look good. Is there a way to make it look ok for the inactive tabs?
  5. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 09 Nov Link to this post

    Hi Pavel,

    You can show the border and set the shape as well:
    RadPageViewStripElement stripElement = (RadPageViewStripElement)this.radPageView1.ViewElement;
    stripElement.Items[0].DrawFill = true;
    stripElement.Items[0].BackColor = ColorTranslator.FromHtml("#91c930") ;
    stripElement.Items[0].GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    stripElement.Items[0].Shape = new RoundRectShape(6, true,false,true,false);
     
    stripElement.Items[0].DrawBorder = true;
    stripElement.Items[0].BorderColor = Color.DarkGray;
    stripElement.Items[0].BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  6. Pavel
    Pavel avatar
    21 posts
    Member since:
    Sep 2016

    Posted 09 Nov in reply to Dimitar Link to this post

    Thank you, that did the trick! I was on the right path with control spy, but somehow never managed to discover the properties that needed to be changed.
Back to Top
UI for WinForms is Visual Studio 2017 Ready