Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

XafApplication.ViewCreating Event

Occurs when creating a View.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public event EventHandler<ViewCreatingEventArgs> ViewCreating

Event Data

The ViewCreating event's data class is ViewCreatingEventArgs. The following properties provide information specific to this event:

Property Description
IsRoot Indicates whether a root View must be created.
ObjectSpace Returns the Object Space to be used when creating a new View.
View Specifies a custom View created in a XafApplication.DetailViewCreating or XafApplication.ListViewCreating event.
ViewID Returns the ID of the created View.

Remarks

Handle this event to provide a custom View instead of a default one. Use the handler’s ViewCreatingEventArgs.View parameter to get information on the View being created. To do this, use the application’s XafApplication.FindModelView method passing the View ID as a parameter.

To specify the Detail View’s current object use the handler’s DetailViewCreatingEventArgs.Obj parameter. Create the Detail View in the Object Space passed as the handler’s ViewCreatingEventArgs.ObjectSpace parameter.

To create a List View, use the collection source passed as the handler’s ListViewCreatingEventArgs.CollectionSource parameter. To specify whether the List View is root, use the handler’s ViewCreatingEventArgs.IsRoot parameter.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ViewCreating 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.

See Also