I've used the ItemsPanelTemplate
on other controls such as the ListBox
, so I figured doing the same thing for the TabControl
would be simple.
Apparently, I'm missing something and the TabControl
is completely ignoring what I place in the ItemsPanelTemplate
.
I have xaml that looks kinda of like this:
<TabControl TabStripPlacement="Right" ItemsSource="{Binding Components}">
<TabControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</TabControl.ItemsPanel>
</TabControl>
I've tried replacing WrapPanel
with UniformGrid
to see if there was a difference and it behaves the same. I do have a ControlTemplate
for TabItem
, but I tried removing it and it made no difference so I don't think that's effecting my problem.
You're probably looking to overwrite the
Template
, not theItemsPanel
You can overwrite
TabControl.ItemTemplate
(orTabItem.Template
) to alter the appearance of the Tabs along the top,TabControl.ContentTemplate
to alter the template used for the content of the Tab, orTabControl.Template
to alter the overall template of the TabControl.I wasn't even aware that TabControl's had an ItemsPanel. I've only ever used that with an ItemsControl, where the ItemsPanel affects what kind of control contains the items in the collection. If the TabControl has that property, I expect it's only because it inherited it from some base class