我有一个TabControl
<TabControl ItemsSource="{Binding TabItemsViewModelCollection}"
ContentTemplateSelector="{StaticResource TabControlTemplateSelector}"
SelectedItem="{Binding OpenedTab, Mode=TwoWay}" >
<TabControl.ItemTemplate>
<!-- this is the header template-->
<DataTemplate>
<TextBlock
Text="{Binding Header}" />
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
每个选项卡都会呈现标题文本,然后是一个关闭按钮。(不确定为什么只在模板中指定了文本块,却出现了关闭按钮。)
但是当我点击关闭按钮时,调试器就会停止工作。我该如何正确处理选项卡的关闭?我有一个包含TabViewModels的ObservableCollection。