關閉tab時,定位到導航欄對應的激活tab
阿新 • • 發佈:2017-05-17
var dpa dxt item table lin logs cnblogs abp
/// <summary> /// 關閉tab時,定位到導航欄對應的激活tab /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DXtrtable_SelectedPageChanged(object sender, TabPageChangedEventArgs e) {if (e.Page.Tag == null) { return; } string functionCode = e.Page.Tag.ToString(); //Tab,每個Tab的代碼 this.SelectItem(functionCode); }
/// <summary> /// DevExpress.XtraNavBar.NavBarControl 導航控件定位或選中狀態 /// 另導航的選項為選中狀態/// </summary> /// <param name="functionCode">Tag的代碼,需要定位的導航項</param> private void SelectItem(string functionCode) { Console.WriteLine(String.Concat("SelectItem", functionCode)); var length = this.DnBarControl.Groups.Count;for (int groupIndex = 0; groupIndex < length; groupIndex++) { var itemLength = this.DnBarControl.Groups[groupIndex].ItemLinks.Count; for (int itemIndex = 0; itemIndex < itemLength; itemIndex++) { var result = this.DnBarControl.Groups[groupIndex].ItemLinks[itemIndex].Item.Tag.ToString(); if (result == functionCode) { this.DnBarControl.Groups[groupIndex].Expanded = true; this.DnBarControl.Groups[groupIndex].SelectedLinkIndex = itemIndex; return; } } } }
關閉tab時,定位到導航欄對應的激活tab