NewObjectViewController.CollectDescendantTypes Event

Occurs when the NewObjectViewController.NewObjectAction's Items List is generated or updated.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v18.1.dll

Declaration

public event EventHandler<CollectTypesEventArgs> CollectDescendantTypes
Public Event CollectDescendantTypes As EventHandler(Of CollectTypesEventArgs)

The event handler receives an argument of the DevExpress.ExpressApp.SystemModule.CollectTypesEventArgs type.

In Windows Forms applications, the New Action's Items list is generated in two steps. First, the current View's object type and its descendants are added; second, the types listed in the Application Model's IModelCreatableItems node are added. To modify the list of the types added first, handle the CollectDescendantTypes event. To access this list, use the handler's CollectTypesEventArgs.Types parameter. To modify the list of the types added second, handle the NewObjectViewController.CollectCreatableItemTypes event.

In ASP.NET applications, there are two Actions: New and NewRootObject. The Items list of the former corresponds to the first items group of the New Action in Windows Forms applications. The Items list of the latter Action corresponds to the second items group of the Windows Forms New Action. So, handle this event to customize the Items collection of the New Action in an ASP.NET application. To customize the Items list of the ASP.NET NewRootObject Action, handle the NewObjectViewController.CollectCreatableItemTypes event.

Note

When you need to customize the Items list of the New Action in the Windows Forms or ASP.NET application version only, handle this event for the WinNewObjectViewController or WebNewObjectViewController individually.

If you need to inherit from the NewObjectViewController and override the caller of the CollectDescendantTypes event, inherit from the WinNewObjectViewController and/or WebNewObjectViewControllers class, and override the UpdateActionState method. In this method, you can get the NewObjectViewController.NewObjectAction's Items collection via the ChoiceActionBase.Items property, and customize it as required.

To see examples of how to handle the CollectDescendantTypes event, refer to the How to: Customize the New Action's Items List topic.