Skip to main content
A newer version of this page is available. .
All docs
V20.2
.NET Standard 2.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.

GridListEditor.GetSelectedObjects() Method

Returns a collection of selected objects.

Namespace: DevExpress.ExpressApp.Blazor.Editors.Grid

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

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.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Blazor.Editors.Grid;
using DevExpress.Persistent.Base;
using MySolution.Module.BusinessObjects;

namespace MySolution.Module.Controllers {
    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 GridListEditor gridListEditor) {
                var selectedObjects = gridListEditor.GetSelectedObjects();
                if(selectedObjects.Count == 1) {
                    gridListEditor.UnselectObject(selectedObjects[0]);
                }
            }
        }
    }
}
See Also