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

Swapping Tabs Location

1 Answer 81 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
lamees
Top achievements
Rank 1
lamees asked on 07 Jan 2008, 02:27 PM
Hey all,
         I am using RadRibbonBar inside my windows application. I want to know if I can swap two tabs locations in runtime. i.e I have tab1 as the first tab in my RibbonBar and tab2 as the second tab in my RibbonBar, what I want to do is to change the tabs locations and to make tab1 as the second tab and tab2 as the first tab in the RibbonBar using a Button click event in runtime. Is this functionality available?
Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 10 Jan 2008, 11:57 AM
Hello lamees,

Thank you for writing.

The functionality you are describing is not currently built in. This could be done using the Drag and drop feature of RadTabStripElement but in the specific case you want to to this using the API. The solution is:

int

indexToRemove = 0;
int indexToAdd = 1;
TabItem item = (TabItem)this.radRibbonBar1.RibbonBarElement.TabStripElement.Items[indexToRemove];
this.radRibbonBar1.RibbonBarElement.TabStripElement.Items.RemoveAt(indexToRemove);
this.radRibbonBar1.RibbonBarElement.TabStripElement.Items.Insert(indexToAdd, item);

Let me expain the upper code snippet further. 

First, I remove the TabItem at the specified index and then I insert it back in the Items collection at an appropriate index. To access the instance of RadTabStripElement which is used in RadRibbonBar the following syntax is used: this.radRibbonBar1.RibbonBarElement.TabStripElement.

indexToRemove is the index of the TabItem in the ribbonBar's tabStripElement's items collection.
indexToInsert is the index where I want to insert my TabItem.

Please let me know if you need further assistance.

Best wishes,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
RibbonBar
Asked by
lamees
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Share this question
or