WPF
WPF

Reputation: 13

How can I close a TabControlEx tab with the middle mouse button?

I'm working with the WPF TabControlEx (close tabs).

I'm looking a way to close the tab clicking the tab header with the mouse wheel click.

Any suggestions?

Thanks a lot for all your help

Upvotes: 1

Views: 326

Answers (2)

RandomEngy
RandomEngy

Reputation: 15413

Add this to your XAML on the tab header:

<Grid.InputBindings>
    <MouseBinding MouseAction="MiddleClick" Command="{Binding CloseCommand}" />
</Grid.InputBindings>

Have your CloseCommand on your ViewModel close the tab. You might also need to pass the specific tab in with the CommandParameter.

Upvotes: 1

Nivid Dholakia
Nivid Dholakia

Reputation: 5462

The Project i was developing was for different purpose but it had the closable tabs if you want to use it you can find it in this forum

Upvotes: 0

Related Questions