CloneObjectViewController.CustomGetCloneActionTargetTypes Event

Occurs before getting the target types list, available via the CloneObjectViewController.CloneObjectAction.

Namespace: DevExpress.ExpressApp.CloneObject

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


public event EventHandler<CustomGetCloneActionTargetTypesEventArgs> CustomGetCloneActionTargetTypes
Public Event CustomGetCloneActionTargetTypes As EventHandler(Of CustomGetCloneActionTargetTypesEventArgs)

Event Data

The CustomGetCloneActionTargetTypes event handler receives an argument of the CustomGetCloneActionTargetTypesEventArgs type.


Handle the CustomGetCloneActionTargetTypes event to add custom target types via the handler's TargetTypes property. To prohibit adding the default target types, set the handler's Handled parameter to true.

By default, the CloneObject Action's ChoiceActionBase.Items collection includes the current object type and types inherited from the current object's base class. To get a list of these types in a CustomGetCloneActionTargetTypes handler, use the CustomGetCloneActionTargetTypesEventArgs.GetDefaultTargetTypes method.

The following code demonstrates how to prohibit adding descendant types of the current object type's base type to the Action's ChoiceActionBase.Items collection:

using DevExpress.ExpressApp.CloneObject;
public class MyCloneObjectController : CloneObjectViewController {
    // ...
    protected override void OnActivated() {
        this.CustomGetCloneActionTargetTypes += 
    private void MyCloneObjectController_CustomGetCloneActionTargetTypes(
        object sender, CustomGetCloneActionTargetTypesEventArgs e) {
        e.Handled = true;

With the code above, the CloneObject Action will clone the currently selected object to the object of the same type, because only the Action's Item will be the current object type. Note that the CustomGetCloneActionTargetTypes event subscription is performed before calling the base OnActivated method. This is done because CustomGetCloneActionTargetTypes is raised from OnActivated. If you want to handle this event from a Controller that is not inherited from the CloneObjectViewController, subscribe in the OnFrameAssigned method.

Alternatively, you can manually fill the Items of the CloneObjectAction by accessing this Action in the Controller's OnActivated method. Refer to the CloneObjectViewController.CloneObjectAction topic to see an example.

See Also