开发者

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 reg开发者_运维百科ion for specific Tab Update:

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

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

Thanks in Advance


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜