Home > DeveloperSection > Forums > Change tab on button click event in wpf
C G E Mannerheim
C G E Mannerheim

Total Post:29

Posted on    July-18-2013 3:03 AM


 1 Reply(s)
 2476  View(s)
Rate this:
HI  experts!

i would like to change to a different tab when i click a button. my xaml is as follow:

<TabControl Name="Tabcontrol1" Margin=" 5" SelectedIndex="0">

            <TabItem Header="Properties" Opacity="1">

                <Grid Width="1185" Height="945" Background="Snow" >



<TabItem Header="Others">





and my button click event:

    private void BuildButton_Click(object sender, RoutedEventArgs e)


    Tabcontrol1.SelectedIndex = "1";


is there something wrong? "Cannot implicitly convert type 'string' to 'int'" appears

thanks in advance

shreesh chandra shukla
shreesh chandra shukla

Total Post:105

Posted on    July-18-2013 11:23 PM

try this.

Remove quotes: Tabcontrol1.SelectedIndex = 1;

Don't want to miss updates? Please click the below button!

Follow MindStick