My scenario:
I have in my form a tabControl. I've extended the TabItem control to some other classes that I want to add the TabControl.
I need that each one of the ExtendedTabItem have a specific header and data template.
Something in the line of:
<DataTemplate DataType="ExtendedTabItem">
<StackPanel Height="100" Width="90">
<TextBlock Text="{Binding Path=Referencia}" FontSize="13"
HorizontalAlignment="Center" Margin="0,0,0,1" />
<TextBlock Text="{Binding Path=Estado}" FontSize="9"
HorizontalAlignment="Center" Margin="0,0,0,1" />
</StackPanel>
</DataTemplate>
And then I could simply
Class ExtendedTabItem : TabItem {
// bla bla bla
}
Action()
{
ExtendedTabItem A = new ExtendedTabItem();
A.Header = SelectedItem.Referencia;
tabControl1.Items.Add(A);
}
Is this doable? All my searches seem to point to the use of an DatTemplateSelector but it does not seem quite what I need.