The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

NewObjectViewController.ObjectCreating Event

Occurs before creating a new object of the type selected in the NewObjectViewController.NewObjectAction's control.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public event EventHandler<ObjectCreatingEventArgs> ObjectCreating
Public Event ObjectCreating As EventHandler(Of ObjectCreatingEventArgs)
public event EventHandler<ObjectCreatingEventArgs> ObjectCreating
Public Event ObjectCreating As EventHandler(Of ObjectCreatingEventArgs)
public event EventHandler<ObjectCreatingEventArgs> ObjectCreating
Public Event ObjectCreating As EventHandler(Of ObjectCreatingEventArgs)

Event Data

The ObjectCreating event handler receives an argument of the ObjectCreatingEventArgs type. The following properties provide information specific to this event.

Property Description
Cancel Specifies whether or not an object creation should be canceled.
DisposeObjectSpaceOnCancel Specified whether or not an Object Space should be disposed on canceling a new object creation.
NewObject Specifies a newly created object.
ObjectSpace Specifies an Object Space used to create a new object.
ObjectType Specifies a type of an object to be created.
ShowDetailView Specifies whether or not a newly created object should be shown in a Detail View.

Remarks

This event can be handled to do the following:

  • Cancel creating a new object. For this purpose, set the event hander's ObjectCreatingEventArgs.Cancel parameter to true. By default, it is set to false.
  • Cancel invoking the Detail View for initialization of the newly created object. For this purpose, set the event handler's ObjectCreatingEventArgs.ShowDetailView parameter to false. By default, it is set to true.
  • Create the new object yourself. For this purpose, use the IObjectSpace object passed as the handler's ObjectCreatingEventArgs.ObjectSpace parameter. To pass the newly created object to the system, set it for the handler's ObjectCreatingEventArgs.NewObject parameter.

To determine the type of the object to be created, use the handler's ObjectCreatingEventArgs.ObjectType parameter.

Note

The WebApplication.OptimizationSettings.AllowFastProcessObjectsCreationActions option can influence the ObjectCreating event. Disable this option as described in the Faster rendering and other performance optimizations for popular Web UI scenarios in XAF KB article, if you face any difficulty when custom processing selected items is implemented in this event handler (e.g., difficulty with the default UI elements rendering or behavior).

To see an example of how to handle the ObjectCreating event, refer to the How to: Limit the Amount of Objects Created using the New Action topic.

See Also