All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Access List View Grid Control Settings Using a Controller

  • 2 minutes to read

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

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

NOTE

The API used in this tutorial is avalable 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() {
                InitializeComponent();
            }
            protected override void OnViewControlsCreated() {
                base.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 control in any List View. The columns are resized with the entire grid control.

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 control properties.

Next Lesson

Place an Action in a Different Location

See Also