CloneObjectViewController.CustomShowClonedObject Event

Occurs before showing the Detail View, displaying the cloned object.

Namespace: DevExpress.ExpressApp.CloneObject

Assembly: DevExpress.ExpressApp.CloneObject.v18.2.dll

Declaration

public event EventHandler<CustomShowClonedObjectEventArgs> CustomShowClonedObject
Public Event CustomShowClonedObject As EventHandler(Of CustomShowClonedObjectEventArgs)

Event Data

The CustomShowClonedObject event handler receives an argument of the CustomShowClonedObjectEventArgs type.

Remarks

By default, the Detail View of the cloned object is displayed after performing cloning. Handle this event to implement the custom code to be executed before, or instead of, displaying the Detail View. Set the handler's Handled parameter to prohibit displaying the Detail View.

The following snippet illustrates how to add the cloned object to the current List View instead of displaying it in the Detail View, when the current View is editable List View. The default behavior persists when the current View is a Detail View or a non-editable List View.

public partial class MyCloneObjectController : CloneObjectViewController  {
    // ...
    protected override void OnActivated() {
        base.OnActivated();
        this.CustomShowClonedObject +=
            new EventHandler<CustomShowClonedObjectEventArgs>(
                MyCloneObjectController_CustomShowClonedObject);
    }
    private void MyCloneObjectController_CustomShowClonedObject(
        object sender, CustomShowClonedObjectEventArgs e) {
        if ((View is ListView) && (View.AllowEdit.ResultValue)) {
            e.TargetObjectSpace.CommitChanges();
            ((ListView)View).CollectionSource.Add(ObjectSpace.GetObject(e.ClonedObject));
            e.Handled = true;
        }
    }
}
See Also