In XAML you can do
<TabItem Selector.Selected="myEvenHandler"></TabItem>
to set the event handler for when that tab is selected. How can I do the exact same thing dynamically. I would prefer not to use the SelectionChanged event of TabControl if I can help it. Clearly there is a Selected event on the TabItem I just cannot seem to get at it in code. Here's what I'd like to do.
TabItem item = new TabItem();
MyCustomControl mcc = new MyCustomControl();
item.Content = mcc;
item.Selected += (s,e) => // This event does not exist
{
selectedControl = mcc;
}
myTabControl.Items.Add(item);