SharpUrBrain
SharpUrBrain

Reputation: 3230

How can I change the default Control template of a TabControl according to my choice

I am trying to develop a Customize TabControl in which I'll divide the Whole TabControl into three Parts:

1)Tab Header 2)Common Region(for all Tab) and 3)Tab Content region for specific Tab Update: alt text

Please provide your best answers or samples if you have then, any type of help will be appreciated.

Thanks in Advance

Upvotes: 0

Views: 1532

Answers (2)

Rachel
Rachel

Reputation: 132558

You can overwrite the TabControl Template to be anything you want, including making it have a static region that stays visible regardless of which tab is selected.

Within the Template, I normally use a panel with IsItemsHost=True to define where the "Tab" portion of the tab control will be displayed and <ContentPresenter ContentSource="SelectedContent" /> where I want the selected tab content to be displayed.

The TabControl.ItemTemplate can also be overwritten to further define your Tabs, and TabControl.ItemContainer can be overwritten to modify just the TabContent part of the TabControl.

Upvotes: 1

Christian
Christian

Reputation: 4375

Hmm ... I don't quite understand why one would do this, but if I were you I would implement this using WPF.

I would implement the tab header as a StackPanel filled with Buttons (their style obviously needs to be redone so that it looks like tabs). The content would be a rectangle containing a grid whose content changes on clicking a button. And that's pretty much it for the basic sceleton. I don't understand your Common Region. What is also nice is to add a little "X" inside each tab in order to close it. That can be done with buttons as well.

It might make sense to use Expression Blend to create such a control.

Best wishes, Christian

Upvotes: 1

Related Questions