Skip to main content
.NET 6.0+

XafApplication.CreateDetailView(IObjectSpace, Object) Method

Creates a Detail View based on information specified in the Application Model for the type of the specified object.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public DetailView CreateDetailView(
    IObjectSpace objectSpace,
    object obj
)

Parameters

Name Type Description
objectSpace IObjectSpace

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

obj Object

An object which is represented by the new Detail View. This object is assigned to the DetailView.CurrentObject property.

Returns

Type Description
DetailView

A Detail View that represents the object passed as the obj parameter.

Remarks

Use this method to create a Detail View for the object specified by the obj parameter. The information on the created Detail View is taken from the Application Model‘ node specified by the IModelClass.DefaultDetailView property of the corresponding IModelClass node.

The object specified in the obj parameter should belong to the Object Space specified in the objectSpace parameter. To pass an object from another Object Space to this Object Space, use the IObjectSpace.GetObject method.

The Object Space specified in the objectSpace parameter should not belong to another View. To pass an Object Space used by another (parent) View to the created DetailView, either use the CreateDetailView method overload with the isRoot parameter, or set the IsRoot property of the created DetailView to false.

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.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) {
        IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Person));
        Object currentObject = objectSpace.GetObject(View.CurrentObject);
        if(currentObject != null) {
            e.View = Application.CreateDetailView(objectSpace, currentObject);
        }
        else {
            objectSpace.Dispose();
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateDetailView(IObjectSpace, Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also