Skip to main content
All docs

Access List View Grid Component Settings Using a Controller (.NET 5)

  • 2 minutes to read

This lesson explains how to access the properties of a grid component displayed within a List View.

In this lesson, you will implement a new View Controller. This controller will change the way the grid component columns are resized.


The API used in this tutorial is available since v20.2.4.

Before you proceed, take a moment to review the following lesson:

Step-by-Step Instructions

  1. In MySolution.Module.Blazor, add a View Controller to the Controllers folder, as described in the Add a Simple Action lesson. Name it “ColumnResizeModeViewController“.
  2. Derive the new controller from the ViewController<ListView> and override the OnViewControlsCreated method as follows.

    using DevExpress.Blazor;
    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Blazor.Editors.Grid;
    namespace MySolution.Module.Blazor.Controllers {
        public partial class ColumnResizeModeViewController : ViewController<ListView> {
            public ColumnResizeModeViewController() {
            // ...
            protected override void OnViewControlsCreated() {
                if(View.Editor is GridListEditor gridListEditor) {
                    IDxDataGridAdapter dataGridAdapter = gridListEditor.GetDataGridAdapter();
                    dataGridAdapter.DataGridModel.ColumnResizeMode = DataGridColumnResizeMode.Component;
            // ...
  3. Run the application. Try to resize any columns in grid component in any List View. The columns are resized with the entire grid component.

    xaf ASP.NET Core Blazor access grid properties resize|

Detailed Explanation

The List View editor exposes the GetDataGridAdapter() method that returns the Component Adapter.

Use the Component Adapter‘s DataGridModel property to access the grid component properties.

Next Lesson

Place an Action in a Different Location

See Also