How to create a working close button

Jun 5, 2015 at 2:20 PM
Edited Jun 5, 2015 at 2:21 PM
I added a close button to the tab control itemtemplate by using a better wpf imagebutton. This works. However, in the dropdown menu for the tabcontrol the imagebutton is also displayed, but clicking the button there does not do anything.

What would be the ideal way to create a close button with a Better WPF tabcontrol?
<betterWpf:ImageButton Source="/Resources/error.png">
        <MouseBinding Command="ApplicationCommands.Close" Gesture="LeftClick" />