DetailView.CurrentObject Property
Specifies an object displayed by the Detail View.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v22.1.dll
Declaration
Property Value
Type | Description |
---|---|
Object | An Object displayed by the Detail View. |
Remarks
The example below demonstrates how to assign a Contact‘s FirstName value to the NickName property via a SimpleAction only in Detail Views.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using MainDemo.Module.BusinessObjects;
// ...
public class SetNickNameController : ViewController<DetailView> {
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;
}
}
}
By default, this property is set to the object that was passed in the Detail View constructor. You can change it. This will raise the View.SelectionChanged, View.CaptionChanged and View.CurrentObjectChanged events one after another.
For additional information, refer to the How to: Access Objects Selected in the Current View help topic.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.