protected override void PopulateTabMasterData(DevExpress.XtraGrid.Tab.ViewTab tabControl, int rowHandle)
        {
            tabControl.HeaderLocation = DetailTabHeaderLocation;
            GridDetailInfo[] details = GetDetailInfo(rowHandle, false);
            if (details == null)
            {
                return;
            }
            int vIndex = GetVisibleDetailRelationIndex(rowHandle);

            foreach (GridDetailInfo detail in details)
            {
                if (!OptionsDetail.AllowExpandEmptyDetails && IsMasterRowEmptyEx(rowHandle, detail.RelationIndex))
                {
                    continue;
                }
                int  detailRows           = DataController.GetDetailList(rowHandle, detail.RelationIndex).Count;
                bool exp                  = vIndex == detail.RelationIndex;
                DetailTabStyleEventArgs e = new DetailTabStyleEventArgs(rowHandle, detail.RelationName, detail.RelationIndex, true);
                RaiseDetailTabStyle(e);
                if (e.Enabled)
                {
                    CreateEnableTabPage(exp, tabControl, detail);
                }
                else
                {
                    CreateDisableTabPage(exp, tabControl, detail);
                }
            }
        }
 private static void AddTabPage(bool exp, DevExpress.XtraGrid.Tab.ViewTab tabControl, ViewTabPage page)
 {
     tabControl.Pages.Add(page);
     if (exp)
     {
         tabControl.SelectedPage = page;
     }
 }
        private void CreateDisableTabPage(bool exp, DevExpress.XtraGrid.Tab.ViewTab tabControl, GridDetailInfo detail)
        {
            DisableViewTabPage page = new DisableViewTabPage(tabControl);

            page.Text       = detail.Caption.Trim();
            page.Tag        = detail.RelationIndex;
            page.DetailInfo = detail;
            AddTabPage(exp, tabControl, page);
        }
Example #4
0
        protected override void PopulateTabMasterData(DevExpress.XtraGrid.Tab.ViewTab tabControl, int rowHandle)
        {
            List <CustomViewTabPage> pages = new List <CustomViewTabPage>();

            base.PopulateTabMasterData(tabControl, rowHandle);
            foreach (ViewTabPage page in tabControl.Pages)
            {
                CustomViewTabPage cPage = new CustomViewTabPage(tabControl);
                cPage.DetailInfo = page.DetailInfo;
                cPage.Tag        = page.Tag;
                cPage.Text       = page.Text;
                cPage.Image      = GetPageImage(rowHandle, (int)cPage.Tag);
                pages.Add(cPage);
            }
            tabControl.Pages.Clear();
            foreach (CustomViewTabPage cPage in pages)
            {
                tabControl.Pages.Add(cPage);
            }
        }