WPF TabItem Element MouseClick Event

rem picture rem · Dec 30, 2009 · Viewed 10.4k times · Source

In WPF app inside a TabControl there is a TabItem element with one Label. I want to fire the event on MouseClick on the Tab of this TabControl, but the event MouseLeftButtonDown:

<TabItem Header="Header1" MouseLeftButtonDown="TabItem_MouseLeftButtonDown" >
      <Label Height="28" Name="AdderLbl" Width="120" Background="Azure" >Label</Label>
</TabItem>

fires only on click over the label. It is not wat I want.

How I could fire the event on MouseClick over the Tab, not its content?

Answer

Aviad P. picture Aviad P. · Dec 30, 2009

What are you trying to achieve? It looks like you're trying to trap when the user moves to the tab, if so you can hook a different event SelectionChanged

:-)