zoukankan      html  css  js  c++  java
  • How to: Create and Show a Detail View of the Selected Object in a Popup Window 如何:在弹出窗口中创建和显示选定对象的详细信息视图

    This topic demonstrates a View Controller that creates and shows a Detail View of the List View's selected object in a popup window.

    本主题演示在弹出窗口中创建和显示列表视图所选对象的详细信息视图的视图控制器。

    Follow the steps below.

    • Create a View Controller with the PopupWindowShowAction.
    • Handle the Action's PopupWindowShowAction.CustomizePopupWindowParams event.
    • In the event handler, create an Object Space using the XafApplication.CreateObjectSpace method.
    • Get the object corresponding to the View.CurrentObject using the IObjectSpace.GetObject method.
    • Create a new Detail View using the XafApplication.CreateDetailView method and pass it to the CustomizePopupWindowParamsEventArgs.View parameter.
    • Optionally, you can customize the Detail View properties (e.g., DetailView.ViewEditMode value).

    按照以下步骤操作。

    • 使用弹出窗口窗口显示操作创建视图控制器。
    • 处理操作的弹出窗口窗口显示操作。
    • 在事件处理程序中,使用 XafApplication.CreateObjectSpace 方法创建对象空间。
    • 使用 IObjectSpace.GetObject 方法获取与 View.Current 对象对应的对象。
    • 使用 Xaf 应用程序创建新的明细视图.创建细节视图方法并将其传递给"自定义弹出窗口ParamsEventArgs.Views"参数。
    • 或者,您可以自定义"详细视图"属性(例如,详细信息视图.ViewEditMode 值)。
    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Actions;
    using DevExpress.ExpressApp.Editors;
    using DevExpress.Persistent.Base;
    //...
    public class ShowDetailViewController : ViewController<ListView> {
        public ShowDetailViewController() {
            PopupWindowShowAction showDetailViewAction = new PopupWindowShowAction(
                this, "ShowDetailView", PredefinedCategory.Edit);
            showDetailViewAction.SelectionDependencyType = SelectionDependencyType.RequireSingleObject;
            showDetailViewAction.TargetObjectsCriteria = "Not IsNewObject(This)";
            showDetailViewAction.CustomizePopupWindowParams += showDetailViewAction_CustomizePopupWindowParams;
        }
        void showDetailViewAction_CustomizePopupWindowParams(
            object sender, CustomizePopupWindowParamsEventArgs e) {
            IObjectSpace newObjectSpace = Application.CreateObjectSpace(View.ObjectTypeInfo.Type);
            Object objectToShow = newObjectSpace.GetObject(View.CurrentObject);
            if (objectToShow != null) {
                DetailView createdView = Application.CreateDetailView(newObjectSpace, objectToShow);
                createdView.ViewEditMode = ViewEditMode.Edit;
                e.View = createdView;
            }
        }
    }

    In this example, the root Detail View is created using an individual Object Space. The root View contains the Save Action and users can explicitly commit changes. You can customize this behavior using the CreateDetailView method overload with the isRoot parameter, or by providing a nested or existing Object Space instead of a new one. Refer to the View.IsRoot property documentation to learn more.

    在此示例中,使用单个对象空间创建根详细信息视图。根视图包含保存操作,用户可以显式提交更改。您可以使用使用 isRoot 参数重载的 CreateDetailView 方法自定义此行为,或者提供嵌套或现有对象空间而不是新对象空间。有关详细信息,请参阅 View.IsRoot 属性文档。

  • 相关阅读:
    NumPy之:NumPy简介教程
    使用gradle插件发布项目到nexus中央仓库
    【Flutter 面试】main入口函数会被调用几次
    【Flutter 混合开发】与原生通信-BasicMessageChannel
    【Flutter 混合开发】与原生通信-MethodChannel
    震惊!!!Oracle SQL语句中竟然支持中文括号??
    Oracle Merge into中修改表的限制条件位置的区别
    Oracle根据local_listener注册service_name在所有监听的ip端口上
    Oracle如何迁移、管理、清除Audit数据(AUD$和FGA_LOG$表)
    Oracle 颠覆认知的无函数处理限定条件字段也可以用上函数索引
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Create-and-Show-a-Detail-View-of-the-Selected-Object-in-a-Popup-Window.html
Copyright © 2011-2022 走看看