Skip to main content
.NET 6.0+

CloneObjectViewController.CustomShowClonedObject Event

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

Namespace: DevExpress.ExpressApp.CloneObject

Assembly: DevExpress.ExpressApp.CloneObject.Xpo.v24.1.dll

Declaration

public event EventHandler<CustomShowClonedObjectEventArgs> CustomShowClonedObject

Event Data

The CustomShowClonedObject event's data class is CustomShowClonedObjectEventArgs. The following properties provide information specific to this event:

Property Description
ClonedObject Gets the target cloned object.
Handled Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.
ShowViewParameters Gets a set of parameters used to display a cloned object’s Detail View.
SourceObject Gets the source cloned object.
TargetObjectSpace Specifies the Object Space of the target cloned object.

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