Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
I am using Tab control in my application. At design time I am not moving on different tab item but at run time its work. It always comes on first tab. Is there any property of tabcontrol that I have to set?
XML
<Window x:Class="DLL_TEACHER.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Teacher"  Height="700" Width="1300">
    <Canvas Width="1249">
        <Image Canvas.Left="0" Canvas.Top="0" Height="71" Name="image1" Stretch="Fill" Width="120" Source="D:\Software Development\vishal_wpf\vishal_WPF\DLL_2008_WPF\DLL_TEACHER\DLL_TEACHER\Images\logo.jpg" />
        <TabControl Canvas.Left="0" Canvas.Top="77" Height="572"  Width="1252"  Name="tabControl1">
            <TabItem Header="Student Status" Name="tabItem1" >
                this is one
            </TabItem>
            <TabItem Header="Lesson Assignment" Name="tabItem2" >
                this is two
            </TabItem>
            <TabItem Header="Lesson Preperation" Name="tabItem3" >
                <Grid>
                </Grid>
            </TabItem>
            <TabItem Header="Saved Lesson" Name="tabItem4" >
                <Grid>
                </Grid>
            </TabItem>
            <TabItem Header="chat" Name="tabItem5" >
                <Grid>
                </Grid>
            </TabItem>
        </TabControl>
    </Canvas>
</Window>
Posted
Updated 18-Apr-11 23:04pm
v3

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Apr-11 11:55am    
Nothing says SP1 not installed. IsSelectected is not used in XAML.
--SA
Prerak Patel 19-Apr-11 23:41pm    
Actually OP wants to switch tabs just like forms tab at design time by mouse click. That was a known bug and taken care in SP1. You set it selected in XAML is a work around for that.
Sergey Alexandrovich Kryukov 20-Apr-11 0:05am    
Well, where the selection is supposed to be without IsSelected before fix and after fix?
--SA
Prerak Patel 20-Apr-11 0:16am    
It is all about "tab clicked should be brought to front, even at design time"
Sergey Alexandrovich Kryukov 20-Apr-11 0:33am    
I understand: a design mode only bug, failure to select. I never saw it. I already voted 5.
My last question is: does it mean other tabs were inaccessible even for adding controls "by mouse" before the fix?
--SA
You'are asking about the property. You can use System.Windows.Forms.TabControl.SelectedIndex.

—SA
 
Share this answer
 
Comments
Espen Harlinn 19-Apr-11 16:32pm    
5ed!
Sergey Alexandrovich Kryukov 19-Apr-11 16:47pm    
Thank you, Espen.
--SA

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