Skip to main content
.NET 6.0+

CloneObjectViewController.CloneObjectAction Property

Gets a SingleChoiceAction Action used to clone persistent objects.

Namespace: DevExpress.ExpressApp.CloneObject

Assembly: DevExpress.ExpressApp.CloneObject.Xpo.v23.2.dll


public SingleChoiceAction CloneObjectAction { get; }

Property Value

Type Description

A SingleChoiceAction object representing an Action used to clone persistent objects.


This Action allows an end-user to clone an object currently selected in a List View or a Detail View’s current object. It invokes a Detail View with a new object. Property values of this object are copied from the object which has been cloned. To prohibit copying certain property value, apply the NonCloneableAttribute attribute to it.

The CloneObject Action is activated for the List and Detail Views representing an object type whose IModelClassCloneable.IsCloneable property is set to true in the Application Model. This Action enables you to create a clone of the current object as an object of the current type (it requires a single object to be selected).

Clone Object Module Winforms Blazor

In addition, you can create an object of the class which is inherited from the current object’s base class. For this purpose, set the base class’ IModelClassCloneable.IsCloneable property to true.

To change the behavior of the CloneObjectAction, create a custom View Controller, override the OnActivated method and access the CloneObjectViewController Controller and its Action. 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 partial class MyCloneObjectController : ViewController {
    protected override void OnActivated()
        CloneObjectViewController cloneObjectController =
        if (cloneObjectController != null) {
            ChoiceActionItem myItem =
                new ChoiceActionItem(View.ObjectTypeInfo.Name, View.ObjectTypeInfo.Type);
            myItem.ImageName =

With the code above, the CloneObject Action will clone the currently selected object to the object of the same type, because the only Action’s Item will be the current object type. Alternatively, you can manually fill the Items of the CloneObjectAction by handling the CloneObjectViewController.CustomGetCloneActionTargetTypes event. Refer to this event description to see an example.

By default, the CloneObject Action is disabled when there are unsaved changes in the current object, because the clone process works in a separate Object Space (see BaseObjectSpace). To change this behavior set the CloneObjectViewController.AllowCloneWhenModified property to true.


The CloneObjectViewController adds a handler to the BaseObjectSpace.ModifiedChanged event of the View.ObjectSpace object. This handler updates the Action’s ActionBase.Enabled property by the “NotModified” key according to AllowCloneWhenModified and BaseObjectSpace.IsModified values. The “NotModified” key name is defined by the CloneObjectViewController.IsNotModifiedEnabledKey constant.

To ascertain why the CloneObject Action is currently deactivated or disabled, use the DiagnosticInfo Action. If you need to change the Action’s “active” or “enabled” state in code, use its ActionBase.Active or ActionBase.Enabled property, respectively.

Information on the CloneObject Action is available in the Application Model‘s ActionDesign node. To access it, use the Model Editor.

See Also