Ticket T919737
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

WinForms - How to show full member paths in customization forms

Win - Show a full member path in the Customization Form - for a TreeList

created 5 years ago (modified 5 years ago)

Hello Support,

I've been following your two tickets, the first one How to show a full member path in the LayoutControl's Customization Form to avoid similar captions for properties with the same last member, which works for DetailView and the second one How to show a full member path in the Customization Form - for list views? which solves this for a ListView. However I've not been able to find a solution which would work for a TreeList.

Here is my code sample:

C#
// one mistake - the event has to be OnActivated() for grid to work //protected override void OnViewControlsCreated() protected override void OnActivated() { base.OnViewControlsCreated(); if (View is DetailView detailView) { ((WinLayoutManager)detailView.LayoutManager).ItemCreated += CustomizationFormCaptionController_ItemCreated; } else if (View is ListView listView) { if (listView.Editor is GridListEditor gridListEditor) { defaultEnablePropertyPathToolTip = GridEditorColumnChooserController.EnablePropertyPathToolTip; GridEditorColumnChooserController.EnablePropertyPathToolTip = false; gridListEditor.CustomizeGridColumn += GridListEditor_CustomizeGridColumn; } else if (listView.Editor is TreeListEditor treeListEditor) { defaultEnablePropertyPathToolTip = TreeListEditorColumnChooserController.EnablePropertyPathToolTip; TreeListEditorColumnChooserController.EnablePropertyPathToolTip = false; // what to do here? } } } private void GridListEditor_CustomizeGridColumn(object sender, CustomizeGridColumnEventArgs e) { e.GridColumn.CustomizationCaption = CaptionHelper.GetFullMemberCaption(View.ObjectTypeInfo, e.GridColumn.FieldName); } private void CustomizationFormCaptionController_ItemCreated(object sender, ItemCreatedEventArgs e) { if (e.ViewItem is PropertyEditor) { e.Item.CustomizationFormText = CaptionHelper.GetFullMemberCaption(View.ObjectTypeInfo, ((PropertyEditor)e.ViewItem).MemberInfo.Name); } }

Could you give me an advice on how to solve this scenario for a TreeList?

Thank you.

Show previous comments (1)
DevExpress Support Team 5 years ago

    Hi Lukáš,

    Would you please clarify if I'm correct that you've managed to achieve the required functionality?

    LL LL
    Lukáš Lindovský 5 years ago

      Hello Gosha,

      I'm sorry for any misunderstanding I may have caused by my comment. I merely updated my sample code in my initial post with correct event.

      My question about possible solution for TreeList is still valid.

      Andrey K (DevExpress Support) 5 years ago

        Hello,

        Thank you for the clarification. Please give us additional time to research this scenario.

        Thanks,
        Andrey

        Answers approved by DevExpress Support

        created 5 years ago (modified 5 years ago)

        Hello Lukáš,
        The TreeListEditor class does not have events to customize an added column. We will discuss the possibility of adding it. Right now, I suggest you create a TreeListEditor descendant and use it in your application. See this help topic: List Editors. Override AddColumnCore as follows:

        C#
        protected override ColumnWrapper AddColumnCore(IModelColumn columnInfo) { TreeListColumnWrapper wrapper = base.AddColumnCore(columnInfo) as TreeListColumnWrapper; wrapper.Column.CustomizationCaption = CaptionHelper.GetFullMemberCaption(ObjectTypeInfo, wrapper.PropertyName); return wrapper; }

        You can also add an event to your class, raise it in this method, and handle it in your controller.

        Let me know if this solution is suitable for you.

        Update:
        The solution for WinForms detail views: S139747 - How to show a full member path in the LayoutControl's Customization Form to avoid similar captions for properties with the same last member
        The solution for WinForms plain list views: T906747 - How to show a full member path in the Customization Form - for list views?
        The common solution: S30014 - WinForms - It is difficult to distinguish fields with the same name in Customization Forms

          Comments (3)
          LL LL
          Lukáš Lindovský 5 years ago

            Hello Alex,

            Thank you for your suggestion. I'll look into it and see if it works for me.

            LL LL
            Lukáš Lindovský 5 years ago

              Hello,

              I have a question. When I create a descendant of a TreeListEditor, does it automatically replace the default TreeListEditor for all relevant list views? Or perhaps is there any way how to set default editor for list views, that use tree list? Because I have hundreds of views in application model and I would not like to change editor for each view separately by hand.

              Thank you.

              LL LL
              Lukáš Lindovský 5 years ago

                Seems like I've found a solution. If I decorate my custom TreeListEditor with [ListEditor(typeof(ITreeNode), true)], it will be set as custom editor for all ListViews, that were previously set to the default DevExpress TreeListEditor.

                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.