I just want to understand the following scenario. Where I am implementing a <TabControl> bound to a ObservableCollection<TabViewModel>
No Data Templates
When I don't have any DataTemplates, the text WpfApplication1.TabViewModel appears in the Tab Header and Content. Ok I understand this part.
Just ItemTemplate
When I just have
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding TabTitle}" />
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
Then my tab header is filled. The tab content is still WpfApplication1.TabViewModel.
Just DataTemplate
When I just have the below in my <Window.Resources>
<DataTemplate DataType="{x:Type local:TabViewModel}">
<TextBox Text="{Binding Text}" />
</DataTemplate>
That templates fills up the tab header.
Both
When I have both, the ItemTemplate fills up the Tab Header while the DataTemplate fills up the tab content. Why all this difference. ItemTemplate & DataTemplate fills up the tab header if the other is not present. If both are present, ItemTemplate fills up the header while DataTemplate fills the content.
Though I have things working, I am quite confused. Shouldn't something like <TabControl.HeaderTemplate> be what fills the header and <TabControl.ItemTemplate> fill up the content?