/// <summary> ///Select the tab control Click event, click the tab header, navigate to the options in the navigation bar, select the state/// </summary> /// <param name= "Sender" ></param> /// <param name= "E" ></param> Private voidXtratabcontrol1_click (Objectsender, EventArgs e) {Xtratabcontrol obj= Sender asXtratabcontrol; DevExpress.XtraTab.XtraTabPage page=obj. Selectedtabpage; stringswitch_on = page. Tag.tostring ();//tab, code for each tab Switch(switch_on) { Case "2001": SelectItem (switch_on); Break; Case "2002": SelectItem (switch_on); Break; Case "2003": SelectItem (switch_on); Break; Case "2004": SelectItem (switch_on); Break; Case "2005": SelectItem (switch_on); Break; Case "2006": SelectItem (switch_on); Break; Case " -": SelectItem (switch_on); Break; default: Break; } } /// <summary> ///DevExpress.XtraNavBar.NavBarControl navigation controls to position or select States///Another option to navigate is selected/// </summary> /// <param name= "Functioncode" >tag code, navigation items that need to be positioned</param> Private voidSelectItem (stringFunctioncode) {Console.WriteLine (Functioncode); varLength = This. NavBarControl1.Groups.Count; for(intGroupindex =0; Groupindex < length; groupindex++) { varItemlength = This. Navbarcontrol1.groups[groupindex]. Itemlinks.count; for(intItemIndex =0; ItemIndex < Itemlength; itemindex++) { varresult = This. Navbarcontrol1.groups[groupindex]. Itemlinks[itemindex]. Item.Tag.ToString (); if(Result = =Functioncode) { This. Navbarcontrol1.groups[groupindex]. Expanded =true; Navbarcontrol1.groups[groupindex]. Selectedlinkindex=ItemIndex; return; } } } }
Select the tab control Click event, click the tab header, navigate to the options for the navigation bar, select the option to navigate the DevExpress.XtraNavBar.NavBarControl navigation control, or select the state in which navigation is selected.