Hide the TabControl header

前端 未结 7 1892
自闭症患者
自闭症患者 2021-02-02 07:21

What\'s the programmatic way (ie not using styles as in this question, but using code) to hide the TabControl header? I\'ll be glad for a snippet.

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-02 07:50

    I've tried this in some code where I populate the tab items manually...

    tabItemToAdd.Visibility = Visibility.Collapsed;
    

    ...but then I had a weird thing happen where the second time I'd clear out the tab control's items, create the tab item again and use this approach before adding it to the tab control, the entire tab item and its contents were gone, not just the tab header. So I've had success with the programmatic equivalent of this solution:

    tabItemToAdd.Template = new ControlTemplate();
    

提交回复
热议问题