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

ListView.CreateCustomCurrentObjectDetailView Event

Occurs when the current List View is updated, and when its current object is changed.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll


public event EventHandler<CreateCustomCurrentObjectDetailViewEventArgs> CreateCustomCurrentObjectDetailView

Event Data

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

Property Description
CurrentDetailView Specifies the Detail View displayed alongside the current List View.
DetailView Specifies a custom Detail View to be created.
DetailViewId Specifies the identifier of a custom Detail View to be created.
ListViewCurrentObject Specifies the current object of the current List View.
ListViewModel Specifies the Application Model‘s node containing information on the currently displayed List View.
ListViewObjectType Specifies the type of the objects displayed by the current List View.


A List View can be displayed together with a Detail View, to the right or at the bottom. This Detail View displays the object which is currently selected in the List View. This mode is set via the IModelListView.MasterDetailMode property of the Application Model‘s Views | <ListView> node. You can create a custom Detail View for a particular selected object or a particular List View. To do this, handle the CreateCustomCurrentObjectDetailView event. Set the custom Detail View for the handler’s DetailView parameter. Alternatively, pass the Detail View’s ID via the DetailViewId parameter. In this instance, the system will create a Detail View using the Detail View identifier you passed. Use the handler’s ListViewObjectType and ListViewCurrentObject parameters, to get the type of the current List View’s objects and the currently selected object. To get the current Detail View, use the handler’s CurrentDetailView parameter. To get the DetailView which is currently set for the current List View in the Application Model (see the Views | <ListView> node’s IModelListView.DetailView property), use the handler’s ListViewModel parameter.


In a simplest case, you can specify the IModelListView.MasterDetailView property in the Model Editor to display an alternate Detail View in a master-detail mode. Note that when both MasterDetailView and DetailView properties are unspecified, the Detail View is automatically determined based on the type of the object created or edited via the List View (the IModelClass.DefaultDetailView value specified for a particular object type is used). So, you should handle the CreateCustomCurrentObjectDetailView event only if you want to implement custom logic for choosing a Detail View.

The following example demonstrates the use of the CreateCustomCurrentObjectDetailView event. Assume you have created a custom Detail View node within the Application Model’s Views node. For instance, you called it “MyCustomDetailView”. You want this Detail View to be displayed near the Person List View, which is shown in the ListViewAndDetailView mode. But, you do not want to use this Detail View to edit the List View’s object in a separate window. If you set your Detail View for the DetailViewID property of the Person_ListView node, it will be shown as close to the List View as when editing an object in a separate window. So, handle the CreateCustomCurrentObjectDetailView event to specify the Detail View that will be shown near the List View. You can do this in a Controller or in the Program.cs (Program.vb) file. The latter approach is demonstrated below:

public class Program {
   public static void Main(string[] arguments) {
      MySolutionWinApplication winApplication = new MySolutionWinApplication();
      winApplication.ListViewCreated += winApplication_ListViewCreated;
   private static void winApplication_ListViewCreated(object sender, ListViewCreatedEventArgs e) {
      if (e.ListView.Id == "Person_ListView"){
         e.ListView.CreateCustomCurrentObjectDetailView += 
            new EventHandler<CreateCustomCurrentObjectDetailViewEventArgs>(
   private static void ListView_CreateCustomCurrentObjectDetailView(object sender, 
         CreateCustomCurrentObjectDetailViewEventArgs e) {
      e.DetailViewId = "MyCustomDetailView";


The code above demonstrates the use of the CreateCustomCurrentObjectDetailView event in a Windows Forms application. In an ASP.NET Web Forms application, the implementation is analogous.

See Also