Click here to Skip to main content
15,886,258 members
Everything / TabControl

TabControl

TabControl

Great Reads

by Richard James Moss
This article describes adding design time support for a TabControl-like component which renders the same way the Project Properties in Visual Studio 2012.
by wpfdev
This blog post is re-posted from www.eriklieben.com. Looking at the file tab of Word 2010, I’ve wondered if a WPF tab control could be transformed to this layout. At first, this felt like something that could never be done, without doing a lot of magic or building it from scratch...
by Brian C Hart
This tip shows how to add support for New Horizontal Tab Group and New Vertical Tab Group commands to the Window menu of an application using the DockPanel Suite by Weifen Luo, and some other minor improvements to help decided if at least one of your windows is docked to the side of the main form an
by PIEBALDconsult
A binary search technique to determine which TabPage of a TabControl was clicked

Latest Articles

by Aleh Baradzenka
In this article, you will learn about an adjustable control that has zooming and scrolling tabs, dragging with the mouse, custom drawing and much more.
by Aleh Baradzenka
This control is another kind of tab. Tabs are displayed as horizontal stripes and can be collapsed into buttons. Each tab is assigned its own window, which is shown when you click on the tab.
by siliconvideo
This article present code that implements a tab control with pop out windows
by _Noctis_
Use a project with a TabControl to quickly test theories, questions, problems

All Articles

Sort by Score

TabControl 

27 Aug 2012 by Richard James Moss
This article describes adding design time support for a TabControl-like component which renders the same way the Project Properties in Visual Studio 2012.
19 Jul 2015 by Mahindra Shambharkar
Issue is with iterating over Visual Tree to find control. If you debug your application you can see that TextBox Control that is present different tabitem than current is not visible and hence not shown in Visual Tree.Just replace FindVisualChildren method with public static...
2 Apr 2019 by BillWoodruff
You gotta drill-down; I'd use Linq: private List DGViews; private void Form1_Load(object sender, EventArgs e) { DGViews = tabControl1.TabPages .Cast() .SelectMany((TabPage tab) => tab.Controls.OfType()) .ToList(); } Since every...
22 Feb 2011 by wpfdev
This blog post is re-posted from www.eriklieben.com. Looking at the file tab of Word 2010, I’ve wondered if a WPF tab control could be transformed to this layout. At first, this felt like something that could never be done, without doing a lot of magic or building it from scratch...
20 Apr 2011 by Tarun.K.S
I tried myself and this is how it will look like : TabControl tc = new TabControl(); TabItem item1 = new TabItem(); item1.Name = "tabIitemContent"; item1.Header = "Tab Item with Buttons"; StackPanel panel = new StackPanel(); ...
20 Apr 2011 by Sergey Alexandrovich Kryukov
This Question makes no sense at all!If this code behind, there is no "convert": code behind is used with XAML, not instead of it.Perhaps, you really need C# equivalent of XAML. In this way, you would though out this XAML and code it all manually in C#. You need to start with some...
6 Jul 2011 by Brian C Hart
This tip shows how to add support for New Horizontal Tab Group and New Vertical Tab Group commands to the Window menu of an application using the DockPanel Suite by Weifen Luo, and some other minor improvements to help decided if at least one of your windows is docked to the side of the main form an
29 Feb 2012 by mustafacaglarkara
xtraTabControl...
20 Aug 2013 by Sergey Alexandrovich Kryukov
There is no such concept as "close" for a tab page. You can delete one, here is...
4 Apr 2019 by Richard Deeming
Here's a helper method I find useful in this sort of situation: public static class TreeExtensions { public static IEnumerable SelectRecursive(this IEnumerable source, Func> getChildren) { if (source is null) throw new...
21 Jun 2012 by Sergey Alexandrovich Kryukov
Yes, TabControl is one of the easiest ways to present the control in multiple "pages" which gives nice results and is convenient enough for the users (unlike MDI which is highly discouraged).Some other styles have benefits, but order of magnitude more complex. For example, docked interface...
2 Dec 2012 by Simon_Whale
I would have a read of this Codeproject article is shows how to change the colour of the tabs.A .NET Flat TabControl (CustomDraw)[^]
25 Mar 2020 by Dave Kreskowiak
You cannot save the control itself. That doesn't even make sense. You can, however, save the information you used to create that tab. When the app launches again, load the information and recreate the tabs as you did before.
16 Feb 2011 by Espen Harlinn
As I’m not privy to your code – I can only speculate. How about a visible tabs collection or visible tab index property in your view model? A bit of modulus trickery could cause this to automagically wrap around to the first visible tab when passing the end of the collection - well it's just a...
11 Apr 2011 by snamyna
Hye..I am used to try putting tabcontainer ajax control in my page before but it ended up with a failure where the content does not appear when i view it in the browser. I keep trying until now, but the same thing happen. It does not show any error but it just does not show up. Is there anybody...
18 Aug 2011 by Syed Salman Raza Zaidi
This[^]A...
14 Sep 2011 by Md. Rashim Uddin
Please have a look on that. This is very handy.Header Editable Tab Control in WPF[^]
7 Jan 2012 by PIEBALDconsult
A binary search technique to determine which TabPage of a TabControl was clicked
25 Dec 2011 by Kabwla.Phone
Determine visibility in complex (or composite) form
3 Jan 2012 by Lutosław
This method, although it doesn't use binary search, handles Multiline tab pages too.private static intGetTabIndexAt( System.Windows.Forms.TabControl tabControl, System.Drawing.Point point){ int result = -1; if (tabControl != null) { for (int i = 0;...
31 May 2012 by Maciej Los
Take a look at similar discussion: How to Open Child Window in tab[^]
21 Jun 2012 by Member 8743576
excuse me sir...i want to build application using C#. and i want multiple page on main form.. all this time i build it with tab control, but not much to look at.. so i try using panel and i find it difficult to change the code and interface... is there a best way to make multiple pages on...
1 Aug 2012 by Sergey Alexandrovich Kryukov
You are showing unrelated code. No, don't show any code right now, you don't really understand what your own code does. You sample is unrelated, because the exception is in...
23 Dec 2012 by akak6
For some reason I am having a heck of a time getting my TabControl to display properly when binding the ItemsSource to a ObservableCollection of view models. I'm basing my design off of the tutorial found here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx. I did find a few questions...
17 Feb 2013 by OriginalGriff
No.Once you Dispose on object you will get an error if you attempt to re-use it as it's resources have been released.You can create a new instance of the page and add that though.
23 Apr 2013 by Naz_Firdouse
You can add the usercontrol as a tabItem itself like or add multiple datatemplates to the tabcontrol...Check...
19 Aug 2013 by vinay.tatipamula
Write OnActiveTabChanged event for the TabContainer you have.And this setup is definitely in a Page where you are loading all the UserControls inside the Tab Container.. so all individual usercontrols's Page_Load events fires when this Page loads.Now keep all the Page_Load functionality...
30 Dec 2013 by Mambo H
If you are using .net 4.0/4.5, check that you have added AjaxTookitScriptManager (and not ScriptManager usually added in .net 2.0). I ran into the same problem and figured that out from this notes
4 Jun 2014 by DamithSL
you can use TabControl.SelectedTab Property[^]for example if you have RichTextBox with name "rtb" in your selected tab, you can check and get the control as below if (tabControl1.SelectedTab.Controls.ContainsKey("rtb")){ RichTextBox selectedRtb =...
4 Jun 2014 by Nivedita_Parihar
Use TabControl.SelectedTab Property to get which is current selected tab
17 Sep 2014 by thesarath
If you are running a 64 bit Pc, download the source of JacksonSoft.CustomTabControl, open the solution, take properties of project from Solution explorer, take Build tab and change Platform Target to "Any CPU". Now build the project. Add the dll of JacksonSoft.CustomTabControl in your project....
6 May 2020 by BillWoodruff
There is a rutorial on how to draw a Tab with a close box here: [^] ... also see: [^]
19 Oct 2020 by Gerry Schmitz
Just change the Height of one Header:
2 Dec 2012 by marcel zol
I have sent an app to my colleagues and they have win7, stlye in win is set to aero stlyle. They see all tabpage-s white even though I see in gray, color is by default "Control". If i try this code: tabControl3.TabPages[0].BackColor = Color.Green;i get the tabpage green, but the...
7 Jan 2011 by Mandavali
I have TabContainer with 5 tabs Lets say I am working on 5th tab, when I click on gridview select then control is transfered back to first Tab?
7 Jan 2011 by Kasson
Hope Gridview[^]will help you to solve your problem.
1 Mar 2011 by Paul Lonsdale
Is there an "out of the box" way to create a tab control that works similar to the one in the Visual Studio 2010 IDE?I want to have a Close "X" on each tab page and a button at the end to list all of the tabs. I would also like to be able to undock the tabs and drag to multiple monitors.
2 Mar 2011 by #realJSOP
Have you looked on Codeplex for code that does it? BTW, VS2010's UI was done with WPF. It should be fairly simple to duplicate the functionality.
2 Mar 2011 by Sergey Alexandrovich Kryukov
Tabbed interface in not a problem, this is a regular control TabControl.I think you're asking about docking interface like in Visual Studio, not just a tabbed part of it. The closest thing I know is AvalonDock for WPF: http://avalondock.codeplex.com/[^].—SA
11 Apr 2011 by Rakesh From Patna
.You try this site
11 Apr 2011 by m@dhu
I don't seem anything wrong with your tab container. The same code has worked for me. Make sure you could access the ajax tool kit. See here[^] for a sample but it is similar to your html.
7 Aug 2011 by Kaz0801
Problem with the TabControl is that when I try to move controls around on the page they move automatically to another page. The only way to locate them in the correct position is to manually adjust the location in the properties box.Frustrating & time consuming - any help would be appreciated....
7 Aug 2011 by OriginalGriff
Is the rectangle a Panel? If so, then when you drag anything over it, it will enter the panel, and stay there.Check: If you right click on a "moved" control, you will get a list of "Select..." items which are the hierarchy of where the control is. For a button (say) directly on a tab page, you...
18 Aug 2011 by version_2.0
Hai all,How to create trapezoid tab header in tabcontrol..?Like Google chrome..Please help..
14 Sep 2011 by Kishore Jangid
I am thinking of developing a MDI in WPF...After googling i came to know that it can be achieved through Tab Control with User Control Library in WPF...Now my question is After Creating My Window in a UserControl and then using XAML code to call the user control...When the Main Window...
24 Sep 2011 by Member 7826605
I have a problem. In my WPF application, if i press a tabItem with middle mouse button, this tabItem should close. Just like in FireFox. But I try to do this using MVVM, and i need to use commands. Also my tabItems are created dynamically. Help me plz! Thank you!
6 Oct 2011 by Sergey Alexandrovich Kryukov
I hope you understand that WPF application is very different from Web application. So, I assume your question is about UI designs and styles and the possibility to implement them using WPF.On the page you referenced, there are two separate things: a main menu which behave pretty much like a...
13 Oct 2011 by Renat Khabibulin
HiIt is MVVM project. I have a ListBox with TabControls inside of it's items. TabItems are different for each TabControl and are binded from ViewModel: Tabs are: public ObservableCollection Tabs { get { return tabs; } ...
13 Oct 2011 by Shmuel Zang
I tried to understand your problem and, I hope I guessed right.If you work MVVM and you change DataContext's, you probably have a view-model that contains the different view-models and the code that changes the DataContext's.Binding SelectedIndex or SelectedItem to the current view-model...
13 Oct 2011 by Renat Khabibulin
I have solved the my issue.The problem was that I used controls as DataContext:- List of TabItems- Controls inside TabItems contentThere was some processes, that I dont undrstand entire. But, idea is that while DataContext's changing, one DataContext can be assigned to 2 different...
25 Dec 2011 by Kabwla.Phone
Set visibility in complex (or composite) form.
8 Dec 2011 by Vijay Bth
Check MouseDown Event of tabItem. In that you find e.ChangedButton = MouseButton.MiddleMay it will help you.
1 Jan 2012 by satrio_budidharmawan
Hi,I wanna ask some question about how to load Tab Control with many of tabs?I'd implement it, but the responses's very slow.Just like this :- I have tabControl with 10 tabs on it.- Each of tab contain variuos kinds of object, just say it datagrid and so on- I click a menu to...
1 Jan 2012 by bbirajdar
Implement lazybinding. That means , only the visible tabs are to be populated with data by default. All other tabs should be populated with data only if clicked or made visible.
20 Feb 2012 by M_Mogharrabi
Hi everyone,I want to change the active tabpage of my XtraTabControl when a button clicked by c# code in runtime.I have tested following codes but any of them did not work :tabpage1.Show();tabpage1.pageVisible=true;xtraTabControl1.tabPages[0].selected=true;how should i do?...
28 Mar 2012 by gsmith2606
Dear all,I am sitting with a small conundrum. I am trying to use a tabcontainer on a form and using buttons to move forward and backwards through the tabs. Reason being, its design for iPad. How do i get the buttons NOT to postback and refresh the page?Much appreciated.Gerhard.
15 Apr 2012 by Robert Dudley
Before I started using Visual Basic 2010 Express again, I used Visual Studio 11 Professional Beta, but decided to roll back because it was running badly on my laptop.In my Web Browser project, which I started in VB11, I used the JacksonSoft CustomTabControl, because I wanted to use Google...
16 Apr 2012 by Robert Dudley
Okay, it doesn't matter! I didn't set the settings in VB2010 Express to Expert Settings - they're preset as Basic Settings in the Express edition.
25 May 2012 by Member 8117281
I am maintaining a VB6 legacy app for a client. There are thousands of copies successfully running all over the world with one exception. My client's customer is getting a RTE 339 error when accessing the TABCTL32.OCX on a WIN7 machine.The thing that's weird is that if the customer boots in...
1 Jun 2012 by Member 8491154
I want to load my user controls data dynamically when the tab panel of the tab container is changed. How can I do this?
11 Jun 2012 by marimir
hi plz plz help me !I designed a program with ribbonbar (it's a component of devcomponents.dotnetbar) and I want to open all of my subfroms in the main form with ribbonbar... so I need to open them in tabcontrol...and I want that I can close each tabs in tabcontrol ...but there is no way...
21 Jun 2012 by Jαved
Hi,I think here is what you are looking for-Visual Studio IDE like Dock Container[^]Simple Dockable Form With VB.Net[^]
28 Jun 2012 by Member 8491154
Found the answer at:Lazy loading tabs
28 Aug 2012 by kurtiniadiss
Hi all,I want to use tab view property in asp.net 1.1 VB. But, it is not supported in this .net version. How can I provide tabbing property in my project. Do you have any ideas?Thanks in advance
8 Sep 2012 by WebMaster
I have TabControl in my project.I want to navigate between tab just manually.Is there any event to override for disabling TabPage_header_click or Sth like that?Thanks for your time.
8 Sep 2012 by WebMaster
I just create my own TabControl after some searches:public class WizardTabControl : TabControl{ protected override void WndProc(ref Message m) { // Hide tabs by trapping the TCM_ADJUSTRECT message if (m.Msg == 0x1328 && !DesignMode) m.Result =...
28 Oct 2012 by pavankumar88v
Hi All,I am developing an WPF application.Which has a WPF TreeView, Frame and TabControl.When i Click on any of the treeitem the corresponding frame and the corresponding tabitem should come into view dynamically.But Now When i select an treeitem, the tabitems are coming into view...
3 Nov 2012 by ompcj4u
Hello Every BodyI'm using wpf and mvvm pattern, in my program when you select a row in datagrid if ID equal zero Save Button Enabled and you can save the record;so if I put datagrid in one TabItem and the Button To Othere TabItem(both of TabItems are blonged to one TabControl) ICommand...
4 Nov 2012 by ompcj4u
Hi JasonExcusme? What is Snoop? or XAML Spy or WPF Spy? xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"...
6 Jan 2013 by satrio_budidharmawan
Hi all,I have a problem on overriding method on vb.netHere's the code : Protected Overrides Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem MsgBox("Draw Item") End SubIt throw...
7 Jan 2013 by fjdiewornncalwe
If you are overriding the DrawItem method you would override Protected Overrides Sub DrawItem..., but only if the class you are writing derives from TabControl.If this is a Form where you simply want to create a handler for the TabControl1.DrawItem method, then just remove the Overrides from...
14 Jan 2013 by Sergey Alexandrovich Kryukov
I finally see that PictureBox is evil. It's harmless, trivial and very rarely useful, but it has a magic effect on the beginners, tho try to use it where it makes no sense at all. I though WPF users will forget it.OK, there is not PictureBox in WPF; and it is not really needed even in Forms....
16 Jan 2013 by rahul-4u
hi,can i access ddlUrgency control that is inside a tabpanel in .aspx. I want to access it form a another trigger that is outside to it. Can i do it in aspx page.something like here is the code...
17 Jan 2013 by dan!sh
You can trigger asynchronous postbacks only from the controls that are present in the update panel. Although, you can call Update method on another update panel from the event handler to refresh the HTML.
25 Jan 2013 by Sergey Alexandrovich Kryukov
OK, I can see this is about System.Windows.Forms.TabControl, but you should always tag it: "Forms". This is not your first question.You need to use one of these properties, or...
28 Jan 2013 by RaudraRudra
Hello to all.I am beginner in c#, and trying to develop a project.I am creating tab Control having close button in each tab page of tab control,so I am using customized Tab Control.But that Tab Control is not showing title of tab page i.e. text Property of tab page...
15 Feb 2013 by Hend Riad
I need to change the panel control inside a tab page with another panel control .. how to catch (get) the panel in the tab page ?
17 Feb 2013 by Hend Riad
If i have a tabControl contains 3 tab pages and i disposed tabpage3, can i re-add it with it's content (not to add empty tabpage) ?
18 Feb 2013 by Marco Bertschi
I was suffering from the same problem a while ago and I found this useful CP article here:A TabControl with tab page closing capability[^]Or you can use this if you like it more fancy ;-):FireFox-like Tab Control[^]cheers,Marco Bertschi
23 Apr 2013 by Curtis Wheller
Hello all,I would like to bind a TabControl to User Controls in order to have each User Control in a TabItem.Is this possible, knowing the TabControl is itself in a UserControl ?Thanks
7 May 2013 by Osman24
It is all about html and javascript. So there are lots of tab components written for .Net 1.0 or higher. This is a good example:Tab control for ASP.NET Applications[^]
19 Aug 2013 by Srinivas Kalabarigi
I have a AJAX TabContainer which in turn contains UserControls in each TabPanel. When the tab is changed i want to call the Page_Load event of the UserControl, as shown below: ...
18 Sep 2013 by Code Mirror
I am creating a WinForm application, in which I have a TabControl1 and at run time created TabPage and PictureBox.On a Button Click, I make new tab page and PictureBox and add them to the TabControl1.Now, I can change image of only last created PictureBox.and when I try to change the...
18 Sep 2013 by Code Mirror
pictureBox1 holds the reference to the last created one, that's the problem.private void button2_Click(object sender, EventArgs e){ PictureBox pb = tabControl1.SelectedTab.Controls.OfType().FirstOrDefault(p => p.Name == "picturebox1name"); if (pb != null) ...
16 Oct 2013 by drushankar
please let me how to register multiple e-mail id in tab at present i have bsnl tab, have registered one gmail account but not able register other email account example Yahoo and outlook
22 Oct 2013 by Usha Sanjee
I'm using tab controller in a page, In this page I'm saving the data to database after that i need the message to be displayed in another page. For this i done as below//tab controller pageResponse.Redirect("CustomerEdit.aspx?Name="+TxtCustomerName.Text);//In another page if...
23 Oct 2013 by Singh Gyan
try this.Dim url As String = "~/SomeDirectory/SomePage.aspx"Response.Redirect(url.Replace("~"c, Request.ApplicationPath))or like thisResponse.Redirect("./hello");
24 Oct 2013 by torin86
Good afternoon to all!I have the next trouble in my WPF app.I have a TabControl and with a Converter, I achieve to resize the width of the Tabitems . This Is working fine.Now, in my app, I want have a Button to remove some of these TabItems and at the same time resize the rest of...
24 Oct 2013 by An@nd Rajan10
first you do "clean solution"then run the project it will successfulenjoy
27 Nov 2013 by Rieth L
I want to take all the names of tables in a database (sql server), and create a tab page for each..public void FillTabControl(TabControl tabControl) { sqlQuery = @"SELECT * FROM SYSOBJECTS WHERE XTYPE='U'"; con = fdc.NewConnection(); ...
27 Nov 2013 by CPallini
Did you Google for, yet?[^][update]Quote:Ok, i already know the query to select all tables, but i doesn't know how to read the output of this query in C# to know the names of each table...Then Google better![^][/update]
27 Jan 2014 by Member 10525317
Thanks to a kind used at stackoverflow, I was able to get this working.I had the shell subscribing to the MainMenu event which wanted to inject either a TestControlA or TestControlB into the TabRegion region, which was wrong.I removed the subscription from the shell and had the...
5 Feb 2014 by Giuditta
Hello all, I have got the following problem. I have three mfc programs, they all are dialog based and created with visual c++, and now i would like to create a fourth program with tab control. Every tab has to be the "container" for a program. Does anyone know if it is feasible? Every help...
5 Feb 2014 by Joan M
Take a look at this article here in :bob: : Hosting .exe applications into a dialog[^]That has been the first result of a Google search...Hope this helps!
7 Feb 2014 by Member 9764132
I am working on windows form application and i have one form Reports with 3 tabs. now when i click a Menu Item on another form, i want form one to be opened with respective tab. private void purchaseToolStripMenuItem_Click(object sender, Event Args e) { Reports report...
16 Apr 2014 by Member 10622146
I am using a TabControl with two TabPages.TabPage 1 Text: "Test Data" and has a Test Data UserControl with a listviewTabPage 2 Text: "Real Data" and has a Real Data UserControl with a listviewI am trying to change the text color of TabPage 2 from black to blue when a new item gets...
16 Apr 2014 by Emre Ataseven
First of all you need a new listview control cuz current one does not have ItemAdded event, so;public class MyListView : ListView{ public event EventHandler ItemAdded; protected override void WndProc(ref Message m) { base.WndProc(ref m); switch (m.Msg) ...
23 Apr 2014 by hari111r
I am binding below tab item collection to two tab controls in two different screen when i switch between the screens tab control does not show any tab items can any one help on this.private ObservableCollection _leftContent = new ObservableCollection(); public...
28 Apr 2014 by Shai Vashdi
Well it's obvious! You are using the same instance of TabItem in two places!TabItem is a Control, i.e. UI and not logic. The idea of code separation between logic & UI (for example MVVM) can help you here:For each TabItem:1. Crate a View-Model containing his data.2. Every...
9 Jun 2014 by Suvabrata Roy
Hi,so with in the save event you can get the current tabTabControl.SelectedTab but your challenge would be something different that is how you will find each DataGrid and TextBox because each object name would be different.Solution :foreach(Control Clt in [Your Tab...