I have a tabcontrol where the tabitem's are datatemplated. The template seems to work correctly, in that the usercontrol I want to show in the tabitem is showing correctly.
What I am not sure of is how to get a "x" to show up in the tabitem so I can close each tab, since they are dynamically generated through a template.
Being fairly new to WPF, I am starting to pick up on many of the concepts, but the tabcontrol gave me a lot of trouble, so I may very well have the template workable, but not maintainable.
This is what I have, and I would like to be able to close each tabcontrol. I will also need to be able to fire a custom event when that tabcontrol is closed.
<UserControl x:Class="Russound.Windows.UI.UserControls.CallLog.CaseReaderWpf"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:CallLog="clr-namespace:Russound.Windows.UI.UserControls.CallLog"
Height="637" Width="505">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Russound.Windows;component/UI/RussoundDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<TabControl x:Name="tabCases" >
<TabControl.ItemTemplate>
<DataTemplate DataType="{x:Type TabItem}">
<StackPanel>
<TextBlock Text="{Binding Path=Id}" />
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type TabItem}">
<CallLog:CaseReadOnlyDisplay DataContext="{Binding}" />
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</UserControl>