TabItem.Index

7 posts, 0 answers
  1. co-logic
    co-logic avatar
    12 posts
    Member since:
    Jun 2006

    Posted 02 May 2007 Link to this post

    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

  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 03 May 2007 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Marturo77
    Marturo77 avatar
    7 posts
    Member since:
    May 2007

    Posted 23 May 2007 Link to this post

    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!
  5. Vassil Petev
    Admin
    Vassil Petev avatar
    1765 posts

    Posted 24 May 2007 Link to this post

    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
  6. carisch
    carisch avatar
    7 posts
    Member since:
    Jul 2007

    Posted 08 Aug 2007 Link to this post

    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,
  7. carisch
    carisch avatar
    7 posts
    Member since:
    Jul 2007

    Posted 08 Aug 2007 Link to this post

    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);  
            } 

     

  8. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 09 Aug 2007 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready