WPF获取活动/聚焦选项卡

问题描述:

Heya,



我正在使用带有多重TabElements的TabControl(在运行时动态添加)。



如何找出它们中的哪一个是焦点/当前有效,所以我可以检索它的索引?



谢谢



呃:找不到机会.SelectedItem 30秒后oO

Heya,

I''m having a TabControl with multipple TabElements in it (dynamicly added at runtime).

How do I find out which one of them is focused/currently active, so I can retrieve it''s index?

Thanks

Uh: nevermind found .SelectedItem 30 seconds later oO

用户用

.SelectedItem


public void Test_focus(Object o, EventArgs e)
        {
            if (stageTabCtrl.SelectedItem == EventBrowser)
            {
                MsgBox.Show("EventBrowser");
            }
            else if (stageTabCtrl.SelectedItem == Live_View)
            {
                MsgBox.Show("Live_View");
            }
}




<tabcontrol borderthickness="1,0,1,1" name="stageTabCtrl" gotfocus="Test_focus"></tabcontrol>