Skip to main content
A newer version of this page is available. .
All docs
V21.2
.NET 5.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.
  • The page you are viewing does not exist in the .NET Standard 2.0+ 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.v21.2.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.

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

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