Add an Action that Displays a Pop-up Window
using DevExpress.Persistent.BaseImpl;
// ...
private void ShowNotesAction_CustomizePopupWindowParams(object sender,
CustomizePopupWindowParamsEventArgs e) {
IObjectSpace objectSpace = Application.CreateObjectSpace();
e.View = Application.CreateListView(Application.FindListViewId(typeof(Note)),
new CollectionSource(objectSpace, typeof(Note)), true);
}
using DevExpress.ExpressApp.Editors;
using MySolution.Module.BusinessObjects;
// ...
private void ShowNotesAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e) {
DemoTask task = (DemoTask)View.CurrentObject;
View.ObjectSpace.SetModified(task);
foreach(Note note in e.PopupWindow.View.SelectedObjects) {
if(!string.IsNullOrEmpty(task.Description)) {
task.Description += Environment.NewLine;
}
task.Description += note.Text;
}
ViewItem item = ((DetailView)View).FindItem("Description");
((PropertyEditor)item).ReadValue();
//Save changes to the database if the current Detail View is displayed in the View mode
if(View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View) {
View.ObjectSpace.CommitChanges();
}
}