Back to Devexpress

TableView.SelectCells(Int32, GridColumn, Int32, GridColumn) Method

wpf-devexpress-dot-xpf-dot-grid-dot-tableview-dot-selectcells-x28-system-dot-int32-devexpress-dot-xpf-dot-grid-dot-gridcolumn-system-dot-int32-devexpress-dot-xpf-dot-grid-dot-gridcolumn-x29.md

latest4.7 KB
Original Source

TableView.SelectCells(Int32, GridColumn, Int32, GridColumn) Method

Selects multiple cells.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public void SelectCells(
    int startRowHandle,
    GridColumn startColumn,
    int endRowHandle,
    GridColumn endColumn
)
vb
Public Sub SelectCells(
    startRowHandle As Integer,
    startColumn As GridColumn,
    endRowHandle As Integer,
    endColumn As GridColumn
)

Parameters

NameTypeDescription
startRowHandleInt32

An integer value that specifies the handle of the row containing the cell that identifies the starting point of the selection.

| | startColumn | GridColumn |

A GridColumn object that represents the column containing the cell that identifies the starting point of the selection.

| | endRowHandle | Int32 |

An integer value that specifies the handle of the row containing the cell that identifies the end point of the selection.

| | endColumn | GridColumn |

A GridColumn object that represents the column containing the cell that identifies the ending point of the selection.

|

Remarks

The SelectCells method allows you to select multiple cells, adding them to the existing selection (if any). In this case, the method’s parameters determine the block’s starting and ending edges, respectively.

The SelectCells method does nothing if the DataViewBase.NavigationStyle property isn’t set to GridViewNavigationStyle.Cell and/or the DataControlBase.SelectionMode property isn’t set to Cell.

To select a single cell, use the TableView.SelectCell method.

To learn more on multi-cell selection, see Multiple Cell Selection.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SelectCells(Int32, GridColumn, Int32, GridColumn) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-grid-scrollbar-annotations/CS/WpfApplication25/MainWindow.xaml.cs#L54

csharp
view.SearchString = "Element2";
    view.SelectCells(15, view.Grid.Columns[0], 25, view.Grid.Columns[1]);
}

wpf-grid-scrollbar-annotations/VB/WpfApplication25/MainWindow.xaml.vb#L45

vb
view.SearchString = "Element2"
    view.SelectCells(15, view.Grid.Columns(0), 25, view.Grid.Columns(1))
End Sub

See Also

SelectCell(Int32, GridColumn)

UnselectCell(Int32, GridColumn)

UnselectCells(Int32, GridColumn, Int32, GridColumn)

TableView Class

TableView Members

DevExpress.Xpf.Grid Namespace