title: wpf tabitem header context menu
body: <p>How do I add a context menu to wpf tabitem that only appears when I click on tabitem header and not the content?
  I also need to create tabitems dynamically in .cs so doing this statically in .xaml won't work.</p>
  
  <p>I've tried adding context menu to tabitem.header but it has some problems where if I have
  [tabitem 1][tabitem2    ]
  [tabitemtabitemtabitemta]</p>
  
  <p>[tabitem2    ] is stretched to match the width of tabcontrol.
  any help would be appreciated.</p>
  
  <p>Thanks!</p>