Ticket T561707
Visible to All Users

How to customize captions in the 'Object Model' window when adding an item from the 'Customization' window?

Answers approved by DevExpress Support

created 7 years ago

You can use the GridEditorColumnChooserController.ColumnChooserExtenderChanged and ColumnChooserExtenderBase.ModelBrowserCreated events to implement this scenario:

C#
using DevExpress.ExpressApp; using DevExpress.ExpressApp.DC; using DevExpress.ExpressApp.Win.Controls; using DevExpress.ExpressApp.Win.SystemModule; using DevExpress.XtraTreeList; using DevExpress.XtraTreeList.Columns; using DevExpress.XtraTreeList.Nodes; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XafApplication1.Module.Win.Controllers { public class Controller1 : ViewController<ListView> { GridEditorColumnChooserController gridEditorColumnChooserController; private void ColumnChooserControllerBase_ColumnChooserExtenderChanged(object sender, ColumnChooserExtenderChangedEventArgs e) { if(e.Extender != null) { e.Extender.ModelBrowserCreated += Extender_ModelBrowserCreated; } } private void Extender_ModelBrowserCreated(object sender, DevExpress.ExpressApp.Win.Editors.ModelBrowserCreatedEventArgs e) { if (e.ModelBrowser != null && e.ModelBrowser.FieldsTreeList != null && e.ModelBrowser.FieldsTreeList.Columns.Count > 0) { foreach (TreeListNode node in e.ModelBrowser.FieldsTreeList.Nodes) { UpdateDisplayName(e.ModelBrowser.FieldsTreeList.Nodes, e.ModelBrowser.FieldsTreeList.Columns[0]); } } } private void UpdateDisplayName(TreeListNodes nodes, TreeListColumn treeListColumn) { foreach(TreeListNode node in nodes) { string nodeValue = node.GetValue(treeListColumn) as string; if(nodeValue == "Display Name") { node.SetValue(treeListColumn, "Custom Display Name"); break; } UpdateDisplayName(node.Nodes, treeListColumn); } } protected override void OnActivated() { base.OnActivated(); gridEditorColumnChooserController = Frame.GetController<GridEditorColumnChooserController>(); if(gridEditorColumnChooserController != null) { gridEditorColumnChooserController.ColumnChooserExtenderChanged += ColumnChooserControllerBase_ColumnChooserExtenderChanged; } } protected override void OnDeactivated() { gridEditorColumnChooserController = Frame.GetController<GridEditorColumnChooserController>(); if(gridEditorColumnChooserController != null) { gridEditorColumnChooserController.ColumnChooserExtenderChanged -= ColumnChooserControllerBase_ColumnChooserExtenderChanged; gridEditorColumnChooserController = null; } base.OnDeactivated(); } } }

See the attached project for more details.
See also:
Tooltips in Object Model Popup of CustomizationForm
TreeList.Nodes
TreeListNode.GetValue
TreeListNode.SetValue

    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.