Skip to main content
.NET 6.0+

NewObjectViewController Class

A ViewController descendant that contains the New Action.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public class NewObjectViewController :
    ViewController,
    IComparer<ChoiceActionItem>,
    IModelExtender,
    ICreateObjectActionProvider

Remarks

NewObjectViewController displays the New Action.

ASP.NET Core Blazor
NewObjectViewController New Action in ASP.NET Core Blazor, DevExpress
Windows Forms
NewObjectViewController New Action in Windows Forms, DevExpress
ASP.NET Web Forms

NewObjectViewController New Action in ASP.NET Web Forms, DevExpress

NewObjectViewController NewRootObject Action in ASP.NET Web Forms, DevExpress

Note

In ASP.NET Core Blazor, the New Action is not available in Detail Views.

For more information about the New Action, refer to the NewObjectViewController.NewObjectAction property description.

To customize the default behavior of the New Action, you can inherit from this Controller or subscribe to its events. In addition, you can access the Action to modify its behavior.

Platform Descendant
ASP.NET Core Blazor BlazorModificationsController
Windows Forms WinModificationsController
ASP.NET Web Forms WebModificationsController

If you need to inherit from the NewObjectViewController, the following protected virtual methods are available:

Method

Trigger Action

Description

OnObjectCreating

After the New method call, but before the object is created.

Raises the NewObjectViewController.ObjectCreating event.

OnCustomAddObjectToCollection

After the object has been created, but before it is added to the object collection.

Raises the NewObjectViewController.CustomAddObjectToCollection event.

OnObjectCreated

After the new object has been created and added to the object collection. If the ObjectCreatedEventArgs.ShowDetailView property is set to true, a Detail View with the new object is invoked after calling this method.

Raises the NewObjectViewController.ObjectCreated event.

New

The New Action’s SingleChoiceAction.Execute event.

  • Creates a new object using the handler’s ObjectCreatedEventArgs properties.
  • Adds the new object to the collection source of the Controller’s current List View. If the current View represents a Detail View, the object is added to the List View from which the Detail View was added. If you need to add the new object in a custom way, handle the NewObjectViewController.CustomAddObjectToCollection event and set the handler’s ProcessNewObjectEventArgs.Handled parameter to false.
  • Shows a Detail View with the new object, if the NewObjectViewController.ObjectCreating event handler’s ObjectCreatingArgs.ShowDetailView parameter is set to true.

UpdateActionState

NewObjectViewController activation, changes in the current ListView’s CollectionSource, and changes in the current View’s AllowNew property. In platform-specific Controllers, this method populates the New Action’s ChoiceActionBase.Items collection.

 

To ascertain whether the Controller is active, use the Controller.Active property (see How to: Detect a Lookup List View in Code). If you need to know the reason for its deactivation or activation at runtime, use the DiagnosticInfo Action.

Information about the NewObjectViewController and its New Action is available in the Application Model. To access it, use the Model Editor.

See Also