I have a VB.NET WPF TabControl (with 8 tabs - 2 columns, 4 rows). When clicking on a tab, that active tab always jumps to the top row. Is there a way to prevent this and lock the tabs in the position set at design time? I cant see any properties on the TabControl or TabItems that would allow this.
-
What do you mean 2 columns 4 rows? – paparazzo Dec 28 '12 at 16:04
-
Post your xaml. It's hard to visualize what you're describing. The default behavior of the TabControl isn't like this. – Big Daddy Dec 28 '12 at 16:06
-
1@BigDaddy If you size it down that the headers wrap it does do that. But there is no set rows and columns to my knowledge. – paparazzo Dec 28 '12 at 16:42
-
Override the template. The template *mst* contain this logic. Look at the original template. – usr Jan 03 '13 at 21:24
1 Answers
Usr is correct; you will need to override the template (at the very least) if you want to stick with using the TabControl.
There is an example of overriding the TabControl template here: want to make scrollable tabs for a tabcontrol That link describes how to put in scrollable tabs, if that is an option you would like to consider. That doesn't seem to answer your immediate question, though.
Another option would be to write your own tab panel. You would still need to override the template as in the example, but instead of where it says "TabPanel" you would reference your own, custom tab panel.
The last option I can think of is to have a grid of buttons where each button simply changes the visible content, instead of using the TabControl. Essentially, you'd be implementing a fake TabControl. It might be a simpler project than trying to override the TabPanel, depending on what you are doing.