Click here to Skip to main content
16,018,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 24-Nov-11 4:26am
v2
Comments
LanFanNinja 24-Nov-11 10:55am    
It happens :)

User solved his own question with
.SelectedItem
 
Share this answer
 
Comments
LanFanNinja 24-Nov-11 13:15pm    
+5 I guess this just shows that you should always ask yourself the question first before asking on CodeProject. :)
C#
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");
            }
}

HTML
<tabcontrol borderthickness="1,0,1,1" name="stageTabCtrl" gotfocus="Test_focus"></tabcontrol>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900