e443 - how to enable in-place editing in the winforms tree l
DESCRIPTION
aTRANSCRIPT
-
Tags: .NET, Frameworks (XAF & XPO), eXpressApp Framework
Open in popup window
using System;using DevExpress.Xpo;using DevExpress.ExpressApp;using DevExpress.XtraTreeList;using DevExpress.ExpressApp.DC;using DevExpress.ExpressApp.Model;using DevExpress.ExpressApp.Win.Core;using DevExpress.XtraEditors.Repository;using DevExpress.ExpressApp.Win.Controls;using DevExpress.ExpressApp.TreeListEditors.Win;
namespace WinSolution.Module.Win { public class TreeListInplaceEditViewController : ViewController { private ObjectTreeList treeList; protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); TreeListEditor treeListEditor = View.Editor as TreeListEditor; if (treeListEditor != null) { treeList = (ObjectTreeList)treeListEditor.TreeList; if (treeListEditor.AllowEdit) { treeList.OptionsBehavior.Editable = true; foreach (RepositoryItem ri in treeList.RepositoryItems) ri.ReadOnly = false; foreach (TreeListColumnWrapper columnWrapper in treeListEditor.Columns) { IModelColumn modelColumn = View.Model.Columns[columnWrapper.PropertyName]; if (modelColumn != null) columnWrapper.Column.OptionsColumn.AllowEdit = modelColumn.AllowEdit; } treeList.CellValueChanged += treeList_CellValueChanged; treeList.ShownEditor += treeList_ShownEditor; treeList.OptionsBehavior.ImmediateEditor = true; } } } protected override void OnDeactivated() { if (treeList != null) { treeList.CellValueChanged -= treeList_CellValueChanged; treeList.ShownEditor -= treeList_ShownEditor; } base.OnDeactivated(); } 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); object focusedObject = treeList.FocusedObject; if (focusedObject != null) { IMemberInfo focusedColumnMemberInfo = ObjectSpace.TypesInfo.FindTypeInfo(focusedObject.GetType()).FindMember(e.Column.FieldName); if (focusedColumnMemberInfo != null) focusedColumnMemberInfo.SetValue(focusedObject, Convert.ChangeType(newValue, focusedColumnMemberInfo.MemberType)); } } }}
ID :E443
Mod if ied O n :3/2/2015 9:00:27 PM
Tech n o logy:.NET
Platfo rm:F ramew orks (XAF & XPO )
Produ ct:eXp ressApp F ramew ork
DownloadsExamp le
Examp le Ru n n er
SUPPORT CENTER FAQTraining EventsLocalizationExamplesTickets
Submit a Support TicketSubmit a Support TicketType search string and press Enter
EHow to enable in-place editing in the WinForms tree List View (TreeListEditor)
3This example shows how to implement a custom ViewController that gets access to the TreeList control and makes it editable according tothe XtraTreeList documentation: WinForms Controls > Controls > Tree List > Feature Center > Data Editing TreeListOptionsBehavior.Editable Property TreeList.ShowingEditor Event TreeList.CellValueChanged Event
Take special note that special handling is required for the correct operation of editors for reference properties (e.g., a lookup filteringfunctionality requires obtaining the currently selected record).This is not a complete solution and you will need to modify and test this example code further in other scenarios according to your businessrequirements. For instance, if you require supporting ConditionalAppearance rules, consider using the code from the Q479878 ticket. If yourequire supporting member-level security permissions, consider extending this example by analogy withthe DevExpress.ExpressApp.Win.SystemModule.GridListEditorMemberLevelSecurityController class for GridListEditor.
See also:
How to enable in-place editing in the ASP.NET tree List View (ASPxTreeListEditor)ListEditors.TreeList - Make it possible to edit data directly in the tree list (inplace/inline edit)
Show all comments Leave a Comment
TreeListInplaceEditViewController.cs C# v2013 vol 1.4 - v2014 vol 2.7
Products Free Trials & Demos Buy Support My Account About Us
Log In
E443 - How to enable in-place editing in the WinForms tree List View (TreeListEditor) | DevExpress Support Center 25-May-15
https://www.devexpress.com/Support/Center/Example/Details/E443 1 / 2
-
DEVEXPRESSAbout UsNewsOur AwardsUpcoming EventsUser CommentsCase StudiesReviews and PublicationsLicensingPurchasingMVP ProgramContact UsLogos
.NET CONTROLSWinFormsASP.NETMVCWPFSilverlightWindows 8 XAML
CROSS PLATFORMReportingDocument Automation
MOBILEDevExtreme Mobile
ENTERPRISE TOOLSReport ServerAnalytics Dashboard
FRAMEWORKSeXpressApp Framework
CODE-DEBUG-REFACTORCodeRush for Visual Studio
HTML5 JS WIDGETSDevExtreme Web
iOS 7DataExplorer
FUNCTIONAL WEB TESTINGTestCafe
DELPHI C++BUILDERVCL
SUPPORTSearch the Knowledge BaseMy QuestionsCode ExamplesGetting StartedDemosDocumentationBlogsTrainingWebinars
Current Version/BuildVersion History
FOLLOW US
Your Privacy - Legal Statements Copyright 1998-2014 Developer Express Inc.All trademarks or registered trademarks are property of their respective owners
DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, BusinessApplication Frameworks, and Reporting Systems for Visual Studio, along with high-performanceHTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whetherusing WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help youbuild and deliver your best in the shortest time possible.
If you need additional product information, write to us at [email protected] or call us at +1 (818) 844-3383
E443 - How to enable in-place editing in the WinForms tree List View (TreeListEditor) | DevExpress Support Center 25-May-15
https://www.devexpress.com/Support/Center/Example/Details/E443 2 / 2
How to enable in-place editing in the WinForms tree List View (TreeListEditor)Downloads