Skip to main content
A newer version of this page is available. .

ListView.CurrentObject Property

Specifies a List View’s current object.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.2.dll

Declaration

public override object CurrentObject { get; set; }

Property Value

Type Description
Object

An Object representing the current List View’s current object.

Remarks

The example below demonstrates how to assign a Contact‘s FirstName value to the NickName property via a SimpleAction only in List Views.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using MainDemo.Module.BusinessObjects;
// ...
public class SetNickNameController : ViewController<ListView> {
    public SetNickNameController() {
        SimpleAction setNickNameAction = new SimpleAction(this, "SetNickName", PredefinedCategory.Edit);
        setNickNameAction.Execute += SetNickNameAction_Execute;
    }
    private void SetNickNameAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
        Contact currentObject = View.CurrentObject as Contact;
        if(currentObject != null) {
            currentObject.NickName = currentObject.FirstName;
        }
    }
}

Use this property to access the focused object of the current List View’s ListView.Editor. If the focused object changes, the View.CurrentObjectChanged event is raised.

When a List View is displayed in the ListViewAndDetailView mode (IModelListView.MasterDetailMode), the object specified by the CurrentObject property is displayed in the accompanying Detail View.

For additional information, refer to the How to: Access Objects Selected in the Current View help topic.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CurrentObject property.

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