I want to show the same content for all TabItems in a TabControl:
<TabControl>
<TabItem Header="Tab 1">
<StackPanel>
<ComboBox />
<Button Content="Button" x:Name="bButton" />
</StackPanel>
</TabItem>
<TabItem Header="Tab 2" />
<TabItem Header="Tab 3" />
</TabControl>
Is there an easy way to do this without repeating the code and only in XAML (not using code-behind)?
I moved the
<StackPanel>outside the<TabControl>and set the margins to place it on top of the TabControl:This is the cleanest and simplest approach.