c# - WPF Dynamic TabControl SelectionChanged bug? -
i creating simple application using c# , wpf using mvvm pattern. there main window few buttons , contentcontrol containing list of view models, 1 of them being searchviewmodel. buttons flip between view models. the searchviewmodel bound searchview , contains tabcontrol. itemssource property bound list of searchtabviewmodels. in constructor of searchviewmodel, initializing observablecollection of searchtabviewmodels , adding 2 tabs. first tab has "+" header , other normal search tab. tabcontrol's selectionchanged event bound method checks if "+" tab clicked. if is, new tab inserted before "+" tab , tabcontrol's selectedindex property set index of inserted tab. simple setup. the issue i'm having when application first run, can click "+" tab , insert new tab "+" tab dead , nothing happens when click it. selectionchanged event not fire. i've checked , selectedindex set tab before it's not selected tab. fix it, ha...