NewObjectViewController.CollectDescendantTypes Event
Occurs when the NewObjectViewController.NewObjectAction‘s Items List is generated or updated.
Namespace: DevExpress.ExpressApp.SystemModule
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Event Data
The CollectDescendantTypes event's data class is DevExpress.ExpressApp.SystemModule.CollectTypesEventArgs.
Remarks
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 Web Forms 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 Web Forms application. To customize the Items list of the ASP.NET Web Forms 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 Web Forms 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.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CollectDescendantTypes event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.