I have a WPF TabControl that I have set the ItemTemplate as well as the ContentTemplate. This tab control displays Call Log information based on customer tech support information.
Inside of this same control, I would also like to be able to show a ReturnAuthorization template.
I would like to swap these out based on the object type added to the TabControl's Items collection. Is this something that is possible?
I have some Pseudo-code that sort of shows what I want to pull off:
<TabControl x:Name="tabCases" IsSynchronizedWithCurrentItem="True" ItemContainerStyle="{StaticResource ClosableTabItemTemplate}" >
<TabControl.ItemTemplate>
if ( Type is Entities:Case )
{
<DataTemplate DataType="{x:Type Entities:Case}">
<TextBlock Text="{Binding Path=Id}" />
</DataTemplate>
}
else if ( Type is Entities1:RAMaster )
{
<DataTemplate DataType="{x:Type Entities1:RAMaster}">
<TextBlock Text="{Binding Path=Id}" />
</DataTemplate>
}
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type Entities:Case}">
<CallLog:CaseReadOnlyDisplay DataContext="{Binding}" />
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>