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

TabItem.Index

6 Answers 149 Views
Tabstrip (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
co-logic
Top achievements
Rank 1
co-logic asked on 02 May 2007, 03:48 PM
How can I directly get the TabItem's Index in a TabStrip? There is no Index property.

Currently I use this function:
        private int GetTabIndex(RadElement Item) {
            int i = 0;
            foreach(RadElement E in fTab.Items) {
                if (E == Item) return i;
                i++;
            }
            return -1;
        }
...but that can't be the solution. ;-)

Thanks for your help,
Christian

6 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 03 May 2007, 06:14 AM
Hi Christian,

Indeed we currently do not have an Index property of RadTabStrip, but you could use the following code block to retrieve the index of TabItem in the RadTabStrip:

private int GetIndex(TabItem item) 
  return this.radTabStrip.TabStripElement.Items.IndexOf(item); 

If you need any further assistance please write us back.
Kind regards,
Ray
the telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Marturo77
Top achievements
Rank 1
answered on 23 May 2007, 08:14 PM
Hi, i use this instruccion and receive this message by the compiler

cannot convert from 'Telerik.WinControls.RadElement' to 'Telerik.WinControls.RadItem'

can you help me

thanks!
0
Vassil Petev
Telerik team
answered on 24 May 2007, 11:03 AM
Hello Marturo77,

Could you please open a support ticket and send us a sample project which reproduces the faulty behavior? The code I have pasted has been checked and verified that it works. I think that we are missing something else here.

I'm looking forward for your project.


Regards,
Rob
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
carisch
Top achievements
Rank 1
answered on 08 Aug 2007, 05:07 PM
first reply failed....grrrrr.


I have 5 tabs, if I hide tab 4, the space where 4 was stays.   I wanted to set the index, but don't think I can without removing ALL from the collection and adding back. 

What is the solution for this? 

I can't think of why you'd want to hide a tab, but leave a big empty space in the strip where it was.

Please help,

Thanks,
0
carisch
Top achievements
Rank 1
answered on 08 Aug 2007, 05:40 PM
Okay, maybe this isn't so bad.

 

        private void OrderTabs()  
        {  
            RadItemCollection show = new RadItemCollection();  
            RadItemCollection hide = new RadItemCollection();  
 
            foreach (RadItem tab in radTab.Items)  
            {  
                if (tab.Visibility == ElementVisibility.Visible)  
                    show.Add(tab);  
                else  
                    hide.Add(tab);  
            }  
            radTab.Items.Clear();  
            radTab.Items.AddRange(show);  
            radTab.Items.AddRange(hide);  
        } 

 

0
Boyko Markov
Telerik team
answered on 09 Aug 2007, 07:55 AM
Hello Brian,

You could hide the tab by setting its Visibility property but that tab will still be in the Items collection. You will see a space between the tabs because you've most probably set that property to hidden, but not to collapsed.

The Hidden state means that the item is not shown but its bounds are still calculated in the layout logic. The Collapsed state is similar to an advanced hidden state, i.e the item is not shown and its bounds are not taken into account.

If you need further assistance please feel free to write us.

All the best,
Ray
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Tabstrip (obsolete as of Q2 2010)
Asked by
co-logic
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Marturo77
Top achievements
Rank 1
Vassil Petev
Telerik team
carisch
Top achievements
Rank 1
Share this question
or