Skip to main content
All docs
V24.1
.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.

DxGridListEditor.GetSelectedObjects() Method

Returns a collection of selected objects.

Namespace: DevExpress.ExpressApp.Blazor.Editors

Assembly: DevExpress.ExpressApp.Blazor.v24.1.dll

NuGet Package: DevExpress.ExpressApp.Blazor

Declaration

public override IList GetSelectedObjects()

Returns

Type Description
IList

A collection of the selected objects.

Remarks

The code sample below demonstrates how to create a simple action that unselects a record within a List View. The action is available only when a single item is selected. The GetSelectedObjects method returns a collection of selected items in this sample.

File:
MySolution.Blazor.Server\Controllers\MySelectController.cs in solutions without the ASP.NET Core Blazor-specific module project. MySolution.Module.Blazor\Controllers\MySelectController.cs in solutions with the ASP.NET Core Blazor-specific module project.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Blazor.Editors;
using DevExpress.Persistent.Base;
using MySolution.Module.BusinessObjects;
// ...
public class MySelectController : ObjectViewController<ListView, DemoTask> {
    public MySelectController() {
        SimpleAction unselectTaskAction = new SimpleAction(this, "UnselectTaskAction", PredefinedCategory.View) {
            Caption = "Unselect a Task",
            SelectionDependencyType = SelectionDependencyType.RequireSingleObject,
            TargetViewNesting = Nesting.Root
        };
        unselectTaskAction.Execute += UnselectTaskAction_Execute; ;
    }

    private void UnselectTaskAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
        if(View.Editor is DxGridListEditor gridListEditor) {
            var selectedObjects = gridListEditor.GetSelectedObjects();
            if(selectedObjects.Count == 1) {
                gridListEditor.UnselectObject(selectedObjects[0]);
            }
        }
    }
}
See Also