Back to Devexpress

NewObjectViewController Class

expressappframework-devexpress-dot-expressapp-dot-systemmodule-43a91166.md

latest7.4 KB
Original Source

NewObjectViewController Class

A ViewController descendant that contains the New Action.

Namespace : DevExpress.ExpressApp.SystemModule

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public class NewObjectViewController :
    ViewController,
    IComparer<ChoiceActionItem>,
    IModelExtender,
    ICreateObjectActionProvider
vb
Public Class NewObjectViewController
    Inherits ViewController
    Implements IComparer(Of ChoiceActionItem),
               IModelExtender,
               ICreateObjectActionProvider

Remarks

NewObjectViewController displays the New Action.

ASP.NET Core Blazor Windows Forms

Note

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

Note

In Many-to-Many collections, the New Action is hidden when NewObjectViewController.LinkNewObjectToParentImmediately is set to true.

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.

PlatformDescendant
ASP.NET Core BlazorBlazorModificationsController
Windows FormsWinModificationsController

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.

Implements

ISupportUpdate

IModelExtender

Inheritance

Object MarshalByRefObject Component Controller ViewController NewObjectViewController BlazorNewObjectViewController

WinNewObjectViewController

See Also

NewObjectViewController Members

NewObjectActionItemListMode

How to remove or hide the base class from the New Action's items list

DevExpress.ExpressApp.SystemModule Namespace