Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ListView.EditViewCreated Event

Occurs after the ListView.EditView has been created.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

public event EventHandler<DetailViewCreatedEventArgs> EditViewCreated

#Event Data

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

Property Description
View Specifies the Detail View to be customized in the XafApplication.DetailViewCreated event.

#Remarks

Handle this event to access the Detail View displayed together with a List View.

The following example demonstrates how to make the Department Detail View in MasterDetailMode read-only:

using System;
using DevExpress.ExpressApp;
// ...
public class AllowNewViewController : ViewController<ListView> {
    protected override void OnActivated() {
        base.OnActivated();
        if(View.Model.MasterDetailMode == MasterDetailMode.ListViewAndDetailView) {
            if(View.EditView != null) {
                SetAllowEdit(View.EditView);
            }
            View.EditViewCreated += new EventHandler<DetailViewCreatedEventArgs>(AllowNewViewController_EditViewCreated);
        }
    }
    private void AllowNewViewController_EditViewCreated(object sender, DetailViewCreatedEventArgs e) {
        SetAllowEdit(e.View);
    }
    private void SetAllowEdit(DetailView editView) {
        editView.AllowEdit.SetItemValue("ByObjectType", View.ObjectTypeInfo.Type != typeof(Department));
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        View.EditViewCreated -= AllowNewViewController_EditViewCreated;
    }
}
See Also