Skip to main content
All docs
V25.2
  • How to: Access the Grid Component in a List View

    • 3 minutes to read

    This article explains how to access properties of a grid component displayed in a List View. You can use this technique with any List Editor control.

    Step-by-Step Instructions

    1. In Solution Explorer, navigate to:
      • A platform-independent project in your solution (for example, MySolution.Module)
      • A platform-specific project in a .NET ASP.NET Core Blazor or Windows Forms application (for example, MySolution.Blazor.Server or MySolution.Win).
    2. Add a View Controller to the Controllers folder.
    3. Inherit the controller from the ObjectViewController<ViewType, ObjectType> class and override the OnViewControlsCreated method as demonstrated in the following code example:

      using DevExpress.ExpressApp;
      using DevExpress.ExpressApp.Editors;
      
      namespace MySolution.Module.Controllers {
          public partial class CustomizeGridListEditorColumnController : ObjectViewController<ListView, Paycheck> {
              protected override void OnViewControlsCreated() {
                  base.OnViewControlsCreated();                
                  if (View.Editor is ColumnsListEditor listEditor) {
                      editor.Model.IsFooterVisible = true;
                      foreach (ColumnWrapper column in listEditor.Columns) {
                          if (column.PropertyName == nameof(Paycheck.NetPay)) {
                              column.AllowSummaryChange = false; }
                      }
                  }
              }
          }
      }
      
    4. (Blazor only) The DxGridModel object replicates all parameters of the related DxGrid component. You can use these parameters to configure the underlying component before creation. However, the model does not allow you to access the current component state (for instance, a page index) or call its methods directly.

      Use the ComponentInstance property to access the underlying component instance and its full API.

    Note

    For platform-agnostic Grid List and Tree List customization, use DevExpress.ExpressApp.Editors.ColumnWrapper. For platform-specific customization, use its descendants:

    • DevExpress.ExpressApp.Blazor.Editors.DxGridColumnWrapper (ASP.NET Core Blazor)
    • DevExpress.ExpressApp.Blazor.Editors.DxTreeListColumnWrapper (ASP.NET Core Blazor)
    • DevExpress.ExpressApp.Win.Editors.WinGridColumnWrapper (Windows Forms)

    Platform-Specific Events for Control Customization

    In Windows Forms, a View Item control or a List Editor control may not be ready for customization immediately after creation. If the technique described in this topic does not have the desired effect, handle platform-specific events listed below.

    ASP.NET Core Blazor
    XAF ASP.NET Core Blazor apps do no need specialized events to customize their underlying controls. However, you must use an EventCallback-based approach instead of handling regular C# events for underlying Blazor UI controls. In rare cases, you can also handle the DevExpress.ExpressApp.Blazor.Editors.Models.DxGridModel.ComponentInstanceCaptured event to access underlying component instance and its full API. For more information, refer to the Handle Component Events section.
    Windows Forms:

    The Control object’s HandleCreated, VisibleChanged, or ParentChanged event.

    You can also handle Load or any similar event if the current control type exposes it.

    Contact our Support Center if you need help.

    See Also