expressappframework-devexpress-dot-expressapp-dot-editors-a9af1954.md
The base class for List Editors.
Namespace : DevExpress.ExpressApp.Editors
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
public abstract class ListEditor :
IDisposable,
IProtectedContentEditor,
IServiceProviderClient
Public MustInherit Class ListEditor
Implements IDisposable,
IProtectedContentEditor,
IServiceProviderClient
The following members return ListEditor objects:
List Views are visualized by means of List Editors. A List Editor has a control that is used to display an object collection supplied by a List View. The List Editor handles binding of its control and supports interaction between the List View and the control.
The List Editor that represents a specific List View can be accessed using the ListView.Editor property. The following code snippet demonstrates how to do this by handling the Controller.Activated and ViewController.ViewControlsCreated events:
using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Editors;
using DevExpress.XtraGrid;
//...
public partial class MyController : ViewController {
public MyController() {
TargetViewType = ViewType.ListView;
Activated += MyController_Activated;
ViewControlsCreated += MyController_ViewControlsCreated;
}
private void MyController_Activated(object sender, EventArgs e) {
ListEditor listEditor = ((ListView)View).Editor;
//Do what is required with the List Editor
}
void MyController_ViewControlsCreated(object sender, EventArgs e) {
ListEditor listEditor = ((ListView)View).Editor;
GridControl gridControl = (GridControl)listEditor.Control;
//Do what is required with the List Editor's control
}
}
To display List Views XAF uses GridListEditor in WinForms applications and DxGridListEditor in Blazor applications.
You can use the ListEditor class and its descendant to implement custom List Editors. When deriving from the ListEditor class, you can override the following protected members that are not described in the documentation:
| Member | Description |
|---|---|
AssignDataSourceToControl | Called in the CreateControls() method and the DataSource property setter. |
| This method is abstract. Override it to assign the current List Editor’s data source to the control. | |
CreateControlsCore | Called in the CreateControls() method. |
| This method is abstract. Override it to instantiate the List Editor’s control. | |
OnAllowEditChanged | Called in the AllowEdit property setter. |
| Raises the AllowEditChanged event. Call this method after the List Editor’s edit mode has changed. | |
OnFocusedObjectChanging | Raises the FocusedObjectChanging event. Call this method before the focused object is changed in the List Editor’s control. |
OnFocusedObjectChanged | Raises the FocusedObjectChanged event. Call this method after the focused object is changed in the List Editor’s control. |
OnNewObjectAdding | Raises the NewObjectAdding event. Call this method before a new object is created in the List Editor’s control. |
OnNewObjectCanceled | Raises the NewObjectCanceled event. Call this method after creation of a new object is canceled in the List Editor’s control. |
OnNewObjectCreated | Raises the NewObjectCreated event. Call this method after a new object is created in the List Editor’s control. |
OnProcessSelectedItem | Raises the ProcessSelectedItem event. Call this method when an object is selected in the List Editor’s control and an end-user presses Enter or double-clicks the object. |
OnSelectionChanged | Raises the SelectionChanged event. Call this method after the selection is changed in the List Editor’s control. |
OnSelectionTypeChanged | Raises the SelectionTypeChanged event. Call this method after the List Editor’s supported selection type is changed. |
Typical implementation of the ListEditor class’ descendants comprises the following steps:
CreateControlsCore method. Create and configure an instance of the control that will represent a List View in a UI. Handle the control’s events to call the following methods:OnProcessSelectedItemOnSelectionChangedOnFocusedObjectChangingOnFocusedObjectChangedOnNewObjectAddingOnNewObjectCanceledOnNewObjectCreatedAssignDataSourceToControl method. Assign the List Editor’s data source to its control.IDXPopupMenuHolder interface to support XAF architecture. Override the ContextMenuTemplate property to return the created instance of the control.Note
IControlOrderProvider interface in your custom List Editor.For an example of a List Editor derived from the ListEditor class, refer to the following topics:
Show 18 items
Object ListEditor DxChartListEditor
See Also