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

Any way to scroll to a tab that is hidden from the scroll area?

4 Answers 124 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.
joseph_korn
Top achievements
Rank 1
joseph_korn asked on 21 Aug 2008, 08:48 PM
I have a tab strip control that has a dynamic amount of tabs.  Autoscroll is set to true so that if there is more tabs then there is space to show all tabs, I can scroll back and forth to find the tab I need. The user is also given the ability to add new tabs as is necessary.  When a new tab is created by the user, I want to make it the currently selected tab, and bring focus to the first control on that tab page. I have been able to successfully select the new tab by using tabstrip.SelectedTab = tabstrip.Items(tabstrip.Items.Count - 1).  The problem I have is that sometimes the new tab is way off on the right side, and is hidden from sight because there are too many tabs. Is there some kind of function like ScrollToTab() or some way that I can programatically scroll to that last tab so that I can see it if it is off the screen?

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 22 Aug 2008, 10:52 AM
Hi Joseph,

Thank you for writing.

You should select the desired tab using the RadTabStrip.TabStripElement.ScrollIntoView function.
For example:
//scroll to last item
  tabstrip.TabStripElement.ScrollIntoView( ((TabItem)this.tabstrip.Items[tabstrip.Items.Count - 1]) );

//focus the last item
 
((TabItem) this.tabstrip.Items[tabstrip.Items.Count - 1]).IsSelected = true;

Hope this helps.

Regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
joseph_korn
Top achievements
Rank 1
answered on 22 Aug 2008, 08:26 PM
Thank you for the reply.

I have tried the code below and unfortunately it does not seem to work for me.  However, it is very possible that the issue is still on my end as I am currently reworking my project. The 'ScrollIntoView' function you suggested sounds exactly what I had in mind.  After making some necessary adjustments, I will let you know if I continue to experience problems with this feature.
0
Dan
Top achievements
Rank 1
answered on 15 Nov 2008, 05:47 PM
Is there a VB version of this?
0
Nikolay
Telerik team
answered on 18 Nov 2008, 04:03 PM
Hi Dan,

Here is the VB.NET version of the code snippet:
Me.RadTabStrip1.TabStripElement.ScrollIntoView(CType(Me.RadTabStrip1.Items(Me.RadTabStrip1.Items.Count - 1), TabItem))  
CType(Me.RadTabStrip1.Items(Me.RadTabStrip1.Items.Count - 1), TabItem).IsSelected = True 

Regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Tabstrip (obsolete as of Q2 2010)
Asked by
joseph_korn
Top achievements
Rank 1
Answers by
Peter
Telerik team
joseph_korn
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or