I made a custom control called SmartTabItem, currently just the default implementation:
using System.Windows;
using System.Windows.Controls;
namespace TestControl.Controls
{
public class SmartTabItem : TabItem
{
static SmartTabItem()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SmartTabItem), new FrameworkPropertyMetadata(typeof(SmartTabItem)));
}
}
}
I include it in my TabControl like this:
<Window x:Class="TestControl.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:TestControl.Controls"
Title="Window1" Height="300" Width="300">
<DockPanel Margin="10">
<TabControl>
<controls:SmartTabItem Header="One">content of one</controls:SmartTabItem>
<TabItem Header="Two">content of two</TabItem>
<TabItem Header="Three">content of three</TabItem>
</TabControl>
</DockPanel>
</Window>
But only tabs "Two" and "Three" are displayed. Why isn't the SmartTabItem showing up in the TabControl if it inherits from TabItem?