The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

XafApplication.CreateDetailView(IObjectSpace, IModelDetailView, Boolean) Method

Creates a Detail View based on information from the Application Model's Views | DetailView node specified by the modelDetailView parameter.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public DetailView CreateDetailView(
    IObjectSpace objectSpace,
    IModelDetailView modelDetailView,
    bool isRoot
)
Public Function CreateDetailView(
    objectSpace As IObjectSpace,
    modelDetailView As IModelDetailView,
    isRoot As Boolean
) As DetailView
public DetailView CreateDetailView(
    IObjectSpace objectSpace,
    IModelDetailView modelDetailView,
    bool isRoot
)
Public Function CreateDetailView(
    objectSpace As IObjectSpace,
    modelDetailView As IModelDetailView,
    isRoot As Boolean
) As DetailView
public DetailView CreateDetailView(
    IObjectSpace objectSpace,
    IModelDetailView modelDetailView,
    bool isRoot
)
Public Function CreateDetailView(
    objectSpace As IObjectSpace,
    modelDetailView As IModelDetailView,
    isRoot As Boolean
) As DetailView

Parameters

Name Type Description
objectSpace IObjectSpace

An IObjectSpace object which is used to work with the new Detail View's DetailView.CurrentObject. This object is assigned to the View.ObjectSpace property.

modelDetailView IModelDetailView

An IModelDetailView object that represents the Application Model node that serves as an information source for creating a new Detail View.

isRoot Boolean

true, if the created Detail View is independent and owns the Object Space passed using the objectSpace parameter; false, if the created Detail View is nested to another root View that owns the Object Space. This value is assigned to the View.IsRoot property.

Parameters

Name Type Description
objectSpace IObjectSpace

An IObjectSpace object which is used to work with the new Detail View's DetailView.CurrentObject. This object is assigned to the View.ObjectSpace property.

modelDetailView IModelDetailView

An IModelDetailView object that represents the Application Model node that serves as an information source for creating a new Detail View.

isRoot Boolean

true, if the created Detail View is independent and owns the Object Space passed using the objectSpace parameter; false, if the created Detail View is nested to another root View that owns the Object Space. This value is assigned to the View.IsRoot property.

Parameters

Name Type Description
objectSpace IObjectSpace

An IObjectSpace object which is used to work with the new Detail View's DetailView.CurrentObject. This object is assigned to the View.ObjectSpace property.

modelDetailView IModelDetailView

An IModelDetailView object that represents the Application Model node that serves as an information source for creating a new Detail View.

isRoot Boolean

true, if the created Detail View is independent and owns the Object Space passed using the objectSpace parameter; false, if the created Detail View is nested to another root View that owns the Object Space. This value is assigned to the View.IsRoot property.

Returns

Type Description
DetailView

A Detail View that does not represent any object.

Returns

Type Description
DetailView

A Detail View that does not represent any object.

Returns

Type Description
DetailView

A Detail View that does not represent any object.

Remarks

Use this method to create a Detail View which is not bound to an object. You can set an object separately using the DetailView.CurrentObject property.

Note

Do not use another View's View.ObjectSpace for the creation of a new root View in it. Instead, create a new Object Space using the XafApplication.CreateObjectSpace method for the new root View.

If your Application Model contains several DetailView models of a certain business class, use the modelDetailView parameter to define which model should be used for the created View. To get the default model, use the IModelClass.DefaultDetailView property.

The example below demonstrates how to open an object's Detail View via a PopupWindowShowAction.

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Model;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
// ...
public class ShowDetailViewController : ObjectViewController<ListView, Person> {
    public ShowDetailViewController() {
        PopupWindowShowAction showDetailViewAction = new PopupWindowShowAction(
            this, "ShowDetailView", PredefinedCategory.Edit);
        showDetailViewAction.SelectionDependencyType = SelectionDependencyType.RequireSingleObject;
        showDetailViewAction.CustomizePopupWindowParams += ShowDetailViewAction_CustomizePopupWindowParams;
    }
    private void ShowDetailViewAction_CustomizePopupWindowParams(
        object sender, CustomizePopupWindowParamsEventArgs e) {
        if(View.CurrentObject != null) {
            IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Person));
            IModelClass modelClass = Application.FindModelClass(View.CurrentObject.GetType());
            IModelDetailView defaultDetailView = modelClass.DefaultDetailView;
            e.View = Application.CreateDetailView(objectSpace, defaultDetailView, true);
        }
    }
}
See Also