Monday, October 26, 2009

How To Rename a TAB on DetailView

To Rename a TAB you have to Make a Method given below

Assembly:
DevExpress.XtraLayout;
DevExpress.ExpressApp.Win.Layout;
public void RenameTab(DetailView view, string tabName, bool isVisible)
{ LayoutControl layoutControl = ((LayoutControl)view.Control); foreach (object obj in layoutControl.Items) { if (obj is TabbedControlGroup) { TabbedControlGroup tabbedControlGroup = (TabbedControlGroup)obj; foreach (object item in tabbedControlGroup.TabPages) { string Name = ((LayoutGroup)(item)).Name; if (Name.IndexOf("OriginalTABName1") >= 0 || Name.IndexOf("OrignalTABName2") >= 0) { if (Name.IndexOf(tabName) <= 0) { ((LayoutGroup)(item)).BeginUpdate(); ((LayoutGroup)(item)).CustomizationFormText = tabName; ((LayoutGroup)(item)).Text = tabName; ((LayoutGroup)(item)).EndUpdate(); } return;}}}} layoutControl.EndUpdate(); } Now Write Code on ObjectChange void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e) { if (View is DetailView && View.ObjectTypeInfo.Type == typeof(Ledger)) { if (e.Object.GetType() == typeof(Ledger)) { LayoutControl layoutControl = ((LayoutControl)View.Control); DetailView dv = (DetailView)View; Ledger ldg = (Ledger)View.CurrentObject; LayoutControlItem target = FindLayoutControlItemByName("DeducteeType", ((LayoutControl)(((WinLayoutManager)(dv.LayoutManager)).Container)).Items); ITypeInfo imf = (ITypeInfo)XafTypesInfo.Instance.FindTypeInfo(View.CurrentObject.GetType()); IMemberInfo imi = imf.FindMember("IsTDSApplicable"); Boolean ValueOfIsTDSApplicable = false; if (imi != null) { ValueOfIsTDSApplicable = (Boolean)imi.GetValue(View.CurrentObject); } layoutControl.BeginUpdate(); if (target != null && ValueOfIsTDSApplicable) { RenameTab(dv, "TDSDetails", true); target.Text = "DeducteeType"; } else { RenameTab(dv, "TCSDetails", true); target.Text = "CollecteeType"; } layoutControl.EndUpdate(); }}}

No comments:

Post a Comment

Mat Table Angular

Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...