DetailView.CurrentObject Property
Specifies an object displayed by the Detail View.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
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.
See Also