Back to Devexpress

TableView.SelectCell(Int32, GridColumn) Method

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

latest4.2 KB
Original Source

TableView.SelectCell(Int32, GridColumn) Method

Selects the cell.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public void SelectCell(
    int rowHandle,
    GridColumn column
)
vb
Public Sub SelectCell(
    rowHandle As Integer,
    column As GridColumn
)

Parameters

NameTypeDescription
rowHandleInt32

An integer value that specifies the handle of the row where the cell is located.

| | column | GridColumn |

A GridColumn object that represents the column which contains the cell.

|

Remarks

Use the SelectCell method to select a cell, adding it to the existing selection (if any). A cell is located at the intersection of the specified row and column.

The SelectCell 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 multiple cells, use the TableView.SelectCells 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 SelectCell(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-data-grid-click-column-header-to-select-all-its-cells/CS/B183292SelectingColumnsByClickOnHeader/MainWindow.xaml.cs#L19

csharp
for (int i = 0; i < view.Grid.VisibleRowCount; i++)
    view.SelectCell(i, e.Column as GridColumn);
view.Grid.EndSelection();

wpf-data-grid-click-column-header-to-select-all-its-cells/VB/B183292SelectingColumnsByClickOnHeader/MainWindow.xaml.vb#L25

vb
For i As Integer = 0 To Me.view.Grid.VisibleRowCount - 1
    Me.view.SelectCell(i, TryCast(e.Column, GridColumn))
Next

See Also

SelectCells(Int32, GridColumn, Int32, GridColumn)

UnselectCell(Int32, GridColumn)

UnselectCells(Int32, GridColumn, Int32, GridColumn)

TableView Class

TableView Members

DevExpress.Xpf.Grid Namespace