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.

DxGridListEditor.UnselectObject(Object) Method

Deselects a specified object.

Namespace: DevExpress.ExpressApp.Blazor.Editors

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

NuGet Package: DevExpress.ExpressApp.Blazor

Declaration

public void UnselectObject(
    object objectToUnselect
)

Parameters

Name Type Description
objectToUnselect Object

An object to deselect.

Remarks

The code sample below demonstrates how to create a simple action that deselects a record within a List View. The action is available only when a single item is selected.

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