加载CustomizePopupWindowParams事件并创建窗体弹出
private void popupWindowShowAction1_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
{
//创建IObjectSpace对象
IObjectSpace space = Application.CreateObjectSpace();
//创建SelectCondition对象
SelectCondition condition = space.CreateObject<SelectCondition>();
//创建DetailView对象
DetailView view = Application.CreateDetailView(space, condition, true);
//设置编辑模式为可编辑
view.ViewEditMode = ViewEditMode.Edit;
//将DetailView添加到视图
e.View = view;
}
在模型编辑器里找到bo复制一个ListView
加载Execute点击事件并创建新的窗体以及按钮
private void popupWindowShowAction1_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
{
//获取视图窗体对象
DetailView view = e.PopupWindowView as DetailView;
//将其转换为实体对象
SelectCondition condition = view.CurrentObject as SelectCondition;
//创建IObjectSpace对象
IObjectSpace space = Application.CreateObjectSpace();
//创建ListView对象
ListView listView = Application.CreateListView("Factoryinfo_Custom_ListView", new CollectionSource(space, typeof(Factoryinfo)), false);
//创建窗体视图
e.ShowViewParameters.CreatedView = listView;
//设置窗体上下文
e.ShowViewParameters.Context = TemplateContext.PopupWindow;
//新建一个窗体
e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
DialogController controller = new DialogController();
controller.AcceptAction.Caption = "确定";
controller.CancelAction.Caption = "取消";
e.ShowViewParameters.Controllers.Add(controller);
}
注:Factoryinfo_Custom_ListView是ListView ID
效果: