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

Tab Page Borders..can I make one?

1 Answer 235 Views
TabbedForm
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 2
Rich asked on 06 Apr 2020, 08:36 PM

Hi, I have a Tab Control with several Tab Pages, and I would like to create/modify borders for the actual tab portion...

Is this possible?

 

Thanks much,

Rich

 

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Apr 2020, 04:37 AM

Hello Rich,

You can modify Tab borders in 2 ways.

1. You can create a custom Theme in VisualStyleBuilder. You can find detailed information in our documentation article.

2. You can change RadTabbedForm Tabs borders programmatically. I have attached a project demonstrating this approach ("RadTabbedForm-Borders.zip").

You can set border related properties to RadTabbedFormControlItem instance which is the UI representation of a single Tab. 

RadTabbedFormControlItem item = this.TabbedFormControl.Tabs[0].Item;
item.BorderBottomWidth = 0;
item.BorderLeftColor = Color.Red;
item.BorderTopColor = Color.Green;

However, the tricky part is to achieve your desired result even for Tabs separated from the main collection because those tabs create new forms.

Firstly you can create an instance of RadTabbedFormDragDropService and use it for subscribing to TabbedFormShown event. Then inside the mentioned event you can subscribe to TabbedFormControlCreating which will fire for the control when a new form is creating.  

private void TabbedForm_TabbedFormControlCreating(object sender, TabbedFormControlCreatingEventArgs e)
{
    if (e.TabbedFormControl.Tabs.Count > 0)
    {
        this.StyleTabItem(e.TabbedFormControl.Tabs[0].Item);
    }

    e.TabbedFormControl.TabAdded += this.TabbedFormControl_TabAdded;
    RadTabbedFormDragDropService dragDropService = e.TabbedFormControl.TabbedFormControlElement.ItemDragService;
    dragDropService.TabbedFormShown += this.DragDropService_TabbedFormShown;
}

As you can see in the example above you can create a new instance of RadTabbedFormDragDropService and subscribe to TabbedFormShown event once again in order to apply your border styling logic for new forms. Additionally you can subscribe to the TabAdded event where you can once again apply your styling logic to newly added Tabs. Please refer to the attached solution where you will find the full implementation.

I hope you find this information useful.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
TabbedForm
Asked by
Rich
Top achievements
Rank 2
Answers by
Dimitar
Telerik team
Share this question
or