tags:

views:

184

answers:

2

Hello there,

I cannot figure out how to bring a tabitem to the front of a tabcontrol in a visual studio 2008 wpf project so that I can see the controls I'm editing.

The visual display part only ever shows the controls on the first tabitem. It does works in run time, just not in design time.

Sounds retarded, maybe I am, but I can't figure out how and I'd really appreciate if anyone could tell me how?

I've tried bringing things to the front, pushing things to the back? Clicking through document outline, looking through properties, double clicking, pulling my hair out, banging my head on the wall....

How can something so simple elude me? :(

Thank you.

+1  A: 

Use the IsSelected property on the TabItem

    <TabControl>
        <TabItem Header="Tab1">
            <TextBlock Text="This text is not visible"/>
        </TabItem>
        <TabItem Header="Tab2" IsSelected="True">
            <TextBlock Text="This text is visible" />
        </TabItem>
    </TabControl>
qntmfred
Ic..Thank you so much...that works...bit of an obscure way to do it though...maybe I just too used to winforms...thank you...
Obbles
A: 

Setting the IsSelected property on the TabItem works but it's obscure to say the least and kludgy at best.

This problem has in fact been fixed to work the way you would expect it to work since 8/11/2008 however Windows Update doesn't notify you that the update is available, not even if you check from the Visual Studio 2008 "Help>Check for Updates" menu item. I just ran across this issue myself as I was migrating to a new laptop where the Tab Control worked properly on my old machine but not on my new machine. On closer inspection I found that the difference was that the Visual Studio 2008 SP1 was missing, once I installed that the Tab Control started working properly again. Go to;

http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx

This makes me wonder though, even before the update to VS2008 the Tab Control worked properly in Expression Blend and since the SP1 update was to VS2008, not to the .Net framework, the control shouldn't have changed. So, did Microsoft write the design time behavior for the Tab Control into the UI vs the control itself? That would be very wierd but how would it work in Blend and not VS2008 if the design time behavior was in the control? Maybe Blend and VS2008 each have their own set of control templates that handle design time behavior? You would think that the two programs would share them if they did. Hmmmm...

PS: Don't forget to install the 3 security updates to VS2008 SP1 that Windows Update finds now, 500MB holy cr_p batman.

Jay13
Brilliant! Thank you for this, I'm on my way to install now. How you gurus find these things out is mind boggling!
Obbles