[原] XAF How to Edit multiple objects in a ListViewAndDetailView
2014-11-08 11:09
1781 查看
2014年好久没有更新Blog了,工作调换了,很少用XAF,但还是很关注XAF的发展和学习,对中国的中小企业数据管理软件开发真的太实用了!!
功能比较简单,但很实用,直接上图和代码!
![](http://images.cnitblog.com/blog/19777/201411/081102289711456.png)
ListView處於ListViewAndDetailView編輯模式
功能比较简单,但很实用,直接上图和代码!
![](http://images.cnitblog.com/blog/19777/201411/081102289711456.png)
ListView處於ListViewAndDetailView編輯模式
using System; using System.Linq; using System.Text; using DevExpress.ExpressApp; using DevExpress.Data.Filtering; using System.Collections.Generic; using DevExpress.Persistent.Base; using DevExpress.ExpressApp.Utils; using DevExpress.ExpressApp.Layout; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Editors; using DevExpress.ExpressApp.Templates; using DevExpress.Persistent.Validation; using DevExpress.ExpressApp.SystemModule; using DevExpress.ExpressApp.Model.NodeGenerators; using DevExpress.Xpo; using DevExpress.XtraEditors; using DevExpress.ExpressApp.Win.Templates; namespace SimpleProjectManager.Module.Controllers { // For more typical usage scenarios, be sure to check out http://documentation.devexpress.com/#Xaf/clsDevExpressExpressAppViewControllertopic. public partial class EditerPlusieursLignesListViewController : ViewController<ListView> { public EditerPlusieursLignesListViewController() { InitializeComponent(); RegisterActions(components); // Target required Views (via the TargetXXX properties) and create their Actions. } protected override void OnActivated() { base.OnActivated(); if (View == null) return; if(((ListView)View).EditView == null) return; if( ((ListView)View).EditView.Items==null) return; foreach (ViewItem item in ((ListView)View).EditView.Items) { item.ControlCreated += item_ControlCreated; } } void item_ControlCreated(object sender, EventArgs e) { ViewItem item = (ViewItem)sender; if (item.Control.GetType() == typeof(NestedFrameTemplate)) return; ((BaseEdit)item.Control).EditValueChanged += (sender2, e2) => { if (View != null && View.SelectedObjects.Count > 1) { foreach (XPBaseObject xpo in View.SelectedObjects) { xpo.SetMemberValue(item.Id, ((BaseEdit)sender2).EditValue); } } }; } } }
相关文章推荐
- [原] XAF How to see and edit the time part in the DatePropertyEditor for the System.DateTime property
- How to check invalid objects and broken job in multiple database
- How to get browser name, version and operating system detail in selenium 2(Web driver)
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- How to Exploit Multiple Monitor Support in Memphis and Windows NT 5.0
- How to copy all view private files and Derived objects between views
- XAF How to show custom forms and controls in XAF (Example)
- [原] XAF Split View (aka MasterDetailMode=ListViewAndDetailView) improvements
- How to trim and edit videos in Photos for OS X
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- [原] XAF How to bind a stored procedure to a ListView in XAF
- XAF How to set size of a popup detail view
- how to implement the WaitForMultipleObjects in linux
- How to View MySQL Temp Files and Temp Tables in Linux
- How to invoke the method of managed bean and render view in JSF when we are outside the lifecycle of JSF
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- How to do run-time (or explicit) linking of C++ plug-in components and objects
- [Android 問題] How to Add a Button in ListView, and Make the Event of onClick and onItemClick Coexist?
- How to copy all view private files and Derived objects between views
- XAF How to enable LayoutView mode in the GridControl in List Views