expressappframework-devexpress-dot-expressapp-dot-listview-417291f2.md
Occurs when the current List View is updated, and when its current object is changed.
Namespace : DevExpress.ExpressApp
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
public event EventHandler<CreateCustomCurrentObjectDetailViewEventArgs> CreateCustomCurrentObjectDetailView
Public Event CreateCustomCurrentObjectDetailView As EventHandler(Of CreateCustomCurrentObjectDetailViewEventArgs)
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. |
You can display a Detail View to the right or at the bottom of a List View. This Detail View displays the object selected in the List View. To enable this mode, set the IModelListView.MasterDetailMode property of the Application Model‘s Views | <ListView> node to ListViewAndDetailView. To display an alternate Detail View, you can use one of the following techniques:
MasterDetailView and DetailView properties are unspecified, XAF automatically determines the Detail View based on the type of the object created or edited in the List View (the IModelClass.DefaultDetailView value specified for a specific object type is used).CreateCustomCurrentObjectDetailView event and specify the handler’s DetailView or DetailViewId parameter. Note that when you specify the DetailViewId parameter, XAF creates a Detail View with the passed identifier automatically.When you use the second technique, you can implement custom logic to choose a Detail View and use the following handler’s parameters to access and customize additional details:
ListViewCurrentObjectGets the currently selected object.ListViewObjectTypeGets the type of the current List View’s objects.CurrentDetailViewGets the current Detail View.ListViewModelGets the Detail View currently set for the current List View in the Application Model (see the Views | <ListView> node’s IModelListView.DetailView property).
The following code snippet handles the CreateCustomCurrentObjectDetailView event for the following scenario:
Assume you created a custom Detail View node in the Application Model’s Views node (“MyCustomDetailView” in this example) and enabled ListViewAndDetailView mode for the Person List View. You want to display a Detail View near the Employee List View but do not want to use this Detail View to edit the List View’s object in a separate window. You cannot set the DetailViewID property of the Employee_ListView node to your Detail View because, in this case, XAF uses this Detail View to edit an object in a separate window.
ListViewAndDetailView mode for the Employee List View.CreateCustomCurrentObjectDetailView event and set the DetailViewId parameter to your Detail View in one of the following places:MySolution.Win\WinApplication.cs file in WinForms applications
MySolution.Blazor.Server\BlazorApplication.cs file in ASP.NET Core Blazor applications
public class MySolutionWinApplication : WinApplication {
public MySolutionWinApplication() {
ListViewCreated += MySolutionWinApplication_ListViewCreated;
}
private static void MySolutionWinApplication_ListViewCreated(object sender, ListViewCreatedEventArgs e) {
if (e.ListView.Id == "Employee_ListView"){
e.ListView.CreateCustomCurrentObjectDetailView += ListView_CreateCustomCurrentObjectDetailView;
}
}
private static void ListView_CreateCustomCurrentObjectDetailView(object sender,
CreateCustomCurrentObjectDetailViewEventArgs e) {
e.DetailViewId = "MyCustomDetailView";
}
}
public class MySolutionBlazorApplication : BlazorApplication {
public MySolutionBlazorApplication() {
ListViewCreated += MySolutionBlazorApplication_ListViewCreated;
}
private static void MySolutionBlazorApplication_ListViewCreated(object sender, ListViewCreatedEventArgs e) {
if (e.ListView.Id == "Employee_ListView"){
e.ListView.CreateCustomCurrentObjectDetailView += ListView_CreateCustomCurrentObjectDetailView;
}
}
private static void ListView_CreateCustomCurrentObjectDetailView(object sender,
CreateCustomCurrentObjectDetailViewEventArgs e) {
e.DetailViewId = "MyCustomDetailView";
}
}
See Also