Reputation: 51
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.
Upvotes: 5
Views: 1208
Reputation: 1243
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.
Upvotes: 1