KB Article T921463
Visible to All Users

WinForms - How to show full member paths in customization forms

Scenarios

Once a user adds a property of a related object, it is helpful to indicate an object type it belongs to.
It may also be necessary to distinguish between sub-properties that have the same caption (for instance, Oid or Name).

Solutions

1. Hover over a Customization Form item to see its full caption in a tooltip: S30014 - WinForms - It is difficult to distinguish between fields with the same name in Customization Forms.

2. Display full captions in Customization Form items directly.

2.1. DetailView

C#
using DevExpress.ExpressApp.Editors; using DevExpress.ExpressApp.Utils; using DevExpress.ExpressApp.Win.Layout; namespace YourSolutionName.Module.Win { public class CustomizationFormCaptionController : ViewController<DetailView> { protected override void OnActivated() { base.OnActivated(); ((WinLayoutManager)View.LayoutManager).ItemCreated += CustomizationFormCaptionController_ItemCreated; } void CustomizationFormCaptionController_ItemCreated(object sender, ItemCreatedEventArgs e) { if(e.ViewItem is PropertyEditor) { e.Item.CustomizationFormText = CaptionHelper.GetFullMemberCaption(View.ObjectTypeInfo, (((PropertyEditor)e.ViewItem).MemberInfo).Name); } } protected override void OnDeactivated() { base.OnDeactivated(); ((WinLayoutManager)View.LayoutManager).ItemCreated -= CustomizationFormCaptionController_ItemCreated; } } }

2.2. ListView (GridListEditor)

C#
using DevExpress.ExpressApp; using DevExpress.ExpressApp.Utils; using DevExpress.ExpressApp.Win.Editors; using DevExpress.ExpressApp.Win.SystemModule; namespace YourSolutionName.Module.Win { public class GridColumnChooserCaptionController : ViewController<ListView> { GridListEditor gridListEditor; bool defaultEnablePropertyPathToolTip = true; protected override void OnActivated() { base.OnActivated(); gridListEditor = View.Editor as GridListEditor; if (gridListEditor != null) { defaultEnablePropertyPathToolTip = GridEditorColumnChooserController.EnablePropertyPathToolTip; GridEditorColumnChooserController.EnablePropertyPathToolTip = false; gridListEditor.CustomizeGridColumn += GridListEditor_CustomizeGridColumn; } } private void GridListEditor_CustomizeGridColumn(object sender, CustomizeGridColumnEventArgs e) { e.GridColumn.CustomizationCaption = CaptionHelper.GetFullMemberCaption(View.ObjectTypeInfo, e.GridColumn.FieldName); } protected override void OnDeactivated() { base.OnDeactivated(); if (gridListEditor != null) { GridEditorColumnChooserController.EnablePropertyPathToolTip = defaultEnablePropertyPathToolTip; gridListEditor.CustomizeGridColumn -= GridListEditor_CustomizeGridColumn; gridListEditor = null; } } } }

2.3. ListView (TreeListEditor)

Create a TreeListEditor descendant and override its AddColumnCore method as follows:

C#
using DevExpress.ExpressApp.Editors; using DevExpress.ExpressApp.Model; using DevExpress.ExpressApp.TreeListEditors.Win; using DevExpress.ExpressApp.Utils; using DevExpress.Persistent.Base.General; namespace YourSolutionName.Module.Win.Editors { [ListEditor(typeof(ITreeNode), true)] public class TreeListEditorEx : TreeListEditor { public TreeListEditorEx(IModelListView model) : base(model) { } protected override ColumnWrapper AddColumnCore(IModelColumn columnInfo) { TreeListColumnWrapper wrapper = (TreeListColumnWrapper)base.AddColumnCore(columnInfo); wrapper.Column.CustomizationCaption = CaptionHelper.GetFullMemberCaption(ObjectTypeInfo, wrapper.PropertyName); return wrapper; } } }

To learn how to use this descendant instead of the built-in list editor, refer to the following help topic: List Editors.

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.