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.