WPF获取活动/聚焦选项卡 [英] WPF Get Active/Focused Tab

查看:60
本文介绍了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>


这篇关于WPF获取活动/聚焦选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆