Ticket Q249072
Visible to All Users
Duplicate

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

Tree List Editors - How to edit data directly in the tree view (inplace / inline modifications)

How to assign DataSourceProperty to a Cell in a TreeList

created 15 years ago

Hello DevExppress Team,
i have a problem with a TreeList. I know that you doesn't support the edit mode for TreeLists and thats why this is a question and not a bug. I have already read this issue http://www.devexpress.com/Support/Center/p/Q183229.aspx?searchtext=TreeList+%2b+edit&p=T4|P0|54
As I mentioned before, I can edit in my TreeList. The problem is that the TreeList doesn't support "DataSourceProperty". In the attached screenshot you can see what i mean. Could you tell me how I can reach my goal.
Best regards.

Answers approved by DevExpress Support

created 15 years ago (modified 8 years ago)

Hello Uwe,
I have debugged a modified version of the E443 example, and found that the DataSourceProperty doesn't work because the TreeListEditor doesn't set the active IGridInplaceEdit editor, which is used by the LookupEditorHelper class when creating a lookup ListView.
This functionality will be supported once inplace editng is supported by our tree list editors: Tree List Editors - How to edit data directly in the tree view (inplace / inline modifications).
I have made the necessary modifications to the E443 example, and now your scenario is also supported:

C#
using System; using DevExpress.ExpressApp; using DevExpress.ExpressApp.TreeListEditors.Win; using DevExpress.ExpressApp.Win.Controls; using DevExpress.XtraTreeList; using DevExpress.XtraEditors.Repository; using DevExpress.Persistent.Base; using DevExpress.Xpo; using DevExpress.ExpressApp.Win.Core; namespace WinSolution.Module.Win { public class TreeListInplaceEditViewController : ViewController<ListView> { private ObjectTreeList treeList; protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); TreeListEditor treeListEditor = View.Editor as TreeListEditor; if (treeListEditor != null) { treeList = (ObjectTreeList)treeListEditor.TreeList; foreach (RepositoryItem ri in treeList.RepositoryItems) ri.ReadOnly = false; treeList.CellValueChanged += treeList_CellValueChanged; treeList.ShownEditor += treeList_ShownEditor; treeList.OptionsBehavior.Editable = true; treeList.OptionsView.EnableAppearanceEvenRow = true; treeList.OptionsView.EnableAppearanceOddRow = true; treeList.OptionsBehavior.ImmediateEditor = false; } } protected override void OnDeactivating() { if (treeList != null) { treeList.CellValueChanged -= treeList_CellValueChanged; treeList.ShownEditor -= treeList_ShownEditor; } base.OnDeactivating(); } private void treeList_ShownEditor(object sender, EventArgs e) { IGridInplaceEdit activeEditor = treeList.ActiveEditor as IGridInplaceEdit; if (activeEditor != null && treeList.FocusedObject is IXPSimpleObject) { activeEditor.GridEditingObject = treeList.FocusedObject; } } private void treeList_CellValueChanged(object sender, CellValueChangedEventArgs e) { object newValue = e.Value; if (e.Value is IXPSimpleObject) newValue = ObjectSpace.GetObject(e.Value); ReflectionHelper.SetMemberValue(treeList.FocusedObject, e.Column.FieldName, newValue); ObjectSpace.CommitChanges(); } } }

Let me know in case of any further difficulty.
Thanks,
Dennis

    Comments (1)

      It works.
      Thanks

      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.