Skip to main content
All docs
V23.2
.NET 6.0+
  • The page you are viewing does not exist in the .NET Framework 4.5.2+ platform documentation. This link will take you to the parent topic of the current section.

IDxGridInstanceProvider.GridInstance Property

Provides access to the DxGrid’s properties and methods.

Namespace: DevExpress.ExpressApp.Blazor.Editors

Assembly: DevExpress.ExpressApp.Blazor.v23.2.dll

NuGet Package: DevExpress.ExpressApp.Blazor

Declaration

IGrid GridInstance { get; }

Property Value

Type Description
IGrid

An object that exposes the DxGrid’s properties and methods.

Remarks

Use the GridInstance to call grid instance’s methods. To change grid properties, use the GridModel.

The DxGrid instance becomes available after it is rendered. Always check GridInstance is not null.

public class TestController : ViewController<ListView> {
    public TestController() {
        SimpleAction simpleAction = new SimpleAction(this, "Test Action", DevExpress.Persistent.Base.PredefinedCategory.Edit);
        simpleAction.Execute += (s, e) => {
            if(View.Editor.Control is IDxGridAdapter adapter) {
                // Always check the GridInstance is not `null`.
                adapter.GridInstance?.CollapseAllGroupRows();
            }
        };
    }
}

The code sample below demonstrates how to access DxGrid API using the IDxGridInstanceProvider.ComponentCaptured event.

public class TestController : ViewController<ListView> {
    protected override void OnViewControlsCreated() {
        base.OnViewControlsCreated();
        if(View.Editor.Control is IDxGridAdapter adapter) {
            adapter.ComponentCaptured += (s, e) => {
                e.Grid.CollapseAllGroupRows();
            };
        }
    }
}

Note

Do not cache the grid instance in the controller fields because the grid can be disposed of and then rendered again when a user navigates the XAF application. Handle the IDxGridInstanceProvider.ComponentCaptured event each time you access the grid instance.

See Also