forum

Home / DeveloperSection / Forums / Change tab on button click event in wpf

Change tab on button click event in wpf

Anonymous User 4892 18-Jul-2013
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" >
</Grid>
</TabItem>
<TabItem Header="Others">
<Grid>
</Grid>
</TabItem>
</TabControl>
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


wpf wpf 
Updated on 18-Jul-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By