.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

XafApplication.CreateListView(IObjectSpace, Type, Boolean) Method

Creates a List View used for the objects of the specified type, by default.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public ListView CreateListView(
    IObjectSpace objectSpace,
    Type objectType,
    bool isRoot
)
Public Function CreateListView(
    objectSpace As IObjectSpace,
    objectType As Type,
    isRoot As Boolean
) As ListView
public ListView CreateListView(
    IObjectSpace objectSpace,
    Type objectType,
    bool isRoot
)
Public Function CreateListView(
    objectSpace As IObjectSpace,
    objectType As Type,
    isRoot As Boolean
) As ListView
public ListView CreateListView(
    IObjectSpace objectSpace,
    Type objectType,
    bool isRoot
)
Public Function CreateListView(
    objectSpace As IObjectSpace,
    objectType As Type,
    isRoot As Boolean
) As ListView

Parameters

Name Type Description
objectSpace IObjectSpace

An IObjectSpace object representing the Object Space used to retrieve objects from the database to the created List View's Collection Source.

objectType Type

A Type object specifying the business object type.

isRoot Boolean

true, if the created List View is independent and owns the Object Space passed using the objectSpace parameter; false if the created List 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 representing the Object Space used to retrieve objects from the database to the created List View's Collection Source.

objectType Type

A Type object specifying the business object type.

isRoot Boolean

true, if the created List View is independent and owns the Object Space passed using the objectSpace parameter; false if the created List 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 representing the Object Space used to retrieve objects from the database to the created List View's Collection Source.

objectType Type

A Type object specifying the business object type.

isRoot Boolean

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

Returns

Type Description
ListView

A ListView object used to display the collection of objectType objects.

Returns

Type Description
ListView

A ListView object used to display the collection of objectType objects.

Returns

Type Description
ListView

A ListView object used to display the collection of objectType objects.

Remarks

If you need to create a List View using the information specified in the Application Model, use other CreateListView method overloads.

Pass true to the isRoot parameter if the new View owns the Object Space passed to the objectSpace parameter. If this Object Space already belongs to another View, pass false. Note that certain Controllers and Actions are deactivated in this case. See View.IsRoot for additional information. To avoid this, use the XafApplication.CreateObjectSpace or XafApplication.CreateNestedObjectSpace method to create a new Object Space, and pass this Object Space to the objectSpace parameter.

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.

The following example creates a List View and displays it via a PopupWindowShowAction.

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
// ...
public class ShowListViewController : WindowController {
    public ShowListViewController() {
        PopupWindowShowAction showListViewAction = new PopupWindowShowAction(
            this, "ShowListView", PredefinedCategory.Edit);
        showListViewAction.CustomizePopupWindowParams += ShowListViewAction_CustomizePopupWindowParams;
    }
    private void ShowListViewAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) {
        Type objectType = typeof(Person);
        IObjectSpace newObjectSpace = Application.CreateObjectSpace(objectType);
        e.View = Application.CreateListView(newObjectSpace, objectType, true);
    }
}
See Also