wpf - Change tab on button click event -
i change different tab when click button. xaml 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 button click event:
private void buildbutton_click(object sender, routedeventargs e) { tabcontrol1.selectedindex = "1"; }
is there wrong? "cannot implicitly convert type 'string' 'int'" appears
remove quotes: tabcontrol1.selectedindex = 1;
Comments
Post a Comment