For example, in a Chart window when I click the "+" tab and create a new chart I want to intercept the creation of the ChartTab (a sub-class of NTTabPage) so I can set properties and subscribe to events on the newly created ChartTab. Similarly, I need to intercept the destruction of the ChartTab to unsubscribe events.
Currently I'm subscribing to the INotifyCollectionChanged event of the NTWindow.MainTabControl.Items property like this:
protected override void OnWindowCreated(Window window)
{
base.OnWindowCreated(window);
if (window is Chart chartWindow)
{
var chartWindowMainTabControl = chartWindow.MainTabControl;
_tabControlCollectionView = CollectionViewSource.GetDefaultView(chartWindowMainTabControl.Items);
_tabControlCollectionView.CollectionChanged += TabControlOnCollectionChanged;
}
}
Please advise how I can do this? Thanks.

Comment