.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

XafApplication.DetailViewCreating Event

Occurs when creating a Detail View.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll


public event EventHandler<DetailViewCreatingEventArgs> DetailViewCreating

Event Data

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

Property Description
EnableDelayedObjectLoading For internal use. Use the DetailView.UseAsyncLoading field instead of this property.
IsRoot Indicates whether a root View must be created. Inherited from ViewCreatingEventArgs.
Obj Returns the object that represents a current object for the Detail View to be the created.
ObjectSpace Returns the Object Space to be used when creating a new View. Inherited from ViewCreatingEventArgs.
View Specifies the Detail View which is created in the XafApplication.DetailViewCreating event.
ViewID Returns the ID of the created View. Inherited from ViewCreatingEventArgs.


Handle this event to provide a custom Detail View instead of a default one. Use the handler’s ViewCreatingEventArgs.ViewID parameter to get information on the created Detail View. 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.

The following example demonstrates how to handle the DetailViewCreating event:

using DevExpress.ExpressApp;

namespace MySolution.Module.Controllers {
    public class ContactViewController : ObjectViewController<ListView, Contact> {
        protected override void OnActivated() {
            Application.DetailViewCreating += Application_DetailViewCreating;
        private void Application_DetailViewCreating(object sender, DetailViewCreatingEventArgs e) {
            if (e.ViewID == "Contact_DetailView") {
                e.ViewID = "Contact_DetailView_Copy"; // ID of a custom Detail View


If DetailView.UseAsyncLoading is set to true, note the following:

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DetailViewCreating event.


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