---
title: "Change tab on button click event in wpf"  
description: "Change tab on button click event in wpf"  
author: "Anonymous User"  
published: 2013-07-18  
updated: 2013-07-18  
canonical: https://www.mindstick.com/forum/1317/change-tab-on-button-click-event-in-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# Change tab on button click event in wpf

HI experts!

i would like to change to a different tab when i [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net). 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](https://www.mindstick.com/forum/12790/something-wrong-with-gridview)? "[Cannot implicitly](https://www.mindstick.com/forum/34469/cannot-implicitly-convert-type-long-to-long) [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) type '[string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp)' to '[int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql)'" appears

thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)

## Replies

### Reply by shreesh chandra shukla

Hi!try this.\

Remove quotes: Tabcontrol1.SelectedIndex = 1;


---

Original Source: https://www.mindstick.com/forum/1317/change-tab-on-button-click-event-in-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
