Skip to main content
.NET 6.0+

XafApplication.CreateListView(Type, Boolean) Method

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

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public ListView CreateListView(
    Type objectType,
    bool isRoot
)

Parameters

Name Type Description
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 assigned to the View.ObjectSpace property; 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.

Remarks

With this CreateListView overload, the Object Space passed to the View.ObjectSpace property is created automatically.

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

Use this method to create and initialize a List View according to values passed as parameters.

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.

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);
        e.View = Application.CreateListView(objectType, true);
    }
}
See Also