15 Years later....
Using solutions mentioned by other here (Thanks!) , I ended up using the following code.
I need events to fire only when a tab is clicked.
I have DataGrids in Tabs and selecting any Row would fire the TabControl.SelectionChanged event.
Using this in the TabControl_SelectionChanged event solved my problem.
I added the option to switch by TabItem.Name instead of its SelectedIndex in case I move tabs around in development later.
if (e.OriginalSource is TabControl)
{
var tabControl = e.OriginalSource as TabControl;
if (tabControl.Name == "<YourTabControlName>")
{
switch ((tabControl.SelectedItem as TabItem).Name)
{
case "First_Tab": //First Tabs Name
//DOWORK
break;
case "Second_Tab": //Second Tabs Name
//DOWORK
break;
default:
break;
}
}
}