在建造WinForm时须要加上一机关函数和Show办法
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.ExpressApp.Win; using DevExpress.ExpressApp; namespace WinWjXAF.Module.Win { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public Form1(XafApplication app, DetailViewActionsObject post) : this() { // We don""t currently have a singleton reference to the running // app in Windows Forms -- will be changed. // It would be possible to make changes to WinApplication.cs and // a static property manually of course. In this case // I want to keep changes in a single area for simplicity, // so I""m taking the app reference as a parameter instead. using (IObjectSpace os =app.ObjectSpaceProvider.CreateObjectSpace() ){ //app.ObjectSpaceProvider.CreateObjectSpace( )) { int postCount = os.GetObjectsCount(typeof(DetailViewActionsObject), null); // Of course we can work with the post that has been passed in //contentLabel.Text = // String.Format("This post has the title ""{0}"". It""s one of {1} posts.", // post.Title, postCount); } } public static void Show(XafApplication app, DetailViewActionsObject post) { using (Form1 form = new Form1(app, post)) { form.ShowDialog( ); } } } } 二、建树ViewController,并在ViewController中添加simpleACtion来浮现它 public partial class CustomFormController : ViewController { public CustomFormController() { InitializeComponent(); RegisterActions(components); } private void simpleAction1_Execute(object sender, SimpleActionuteEventArgs e) { Form1.Show(Application, (DetailViewActionsObject)e.CurrentObject); } }