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.
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
Answers approved by DevExpress Support
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