3

I have a 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>

Each tab are rendered with the Header Text and then a close button. (not sure why there are a close button when i only have specified a textblock in the template).

But when i click the close button debugger breaks. How will i handle the clossing of a tab correctly. I have a ObservableCollection with TabViewModels.

Poul K. Sørensen
  • 16,950
  • 21
  • 126
  • 283

1 Answers1

0

I was using https://github.com/MahApps and it had some modified styles for TabControl that i have overlooked, meaning there was added a click action.

Overwriting the style solved the problem.

Poul K. Sørensen
  • 16,950
  • 21
  • 126
  • 283