Swapping Tabs Location

2 posts, 0 answers
  1. lamees
    lamees avatar
    56 posts
    Member since:
    Jul 2006

    Posted 07 Jan 2008 Link to this post

    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
  2. Boyko Markov
    Boyko Markov avatar
    610 posts

    Posted 10 Jan 2008 Link to this post

    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:


    indexToRemove = 0;
    int indexToAdd = 1;
    TabItem item = (TabItem)this.radRibbonBar1.RibbonBarElement.TabStripElement.Items[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
Back to Top