Back to Devexpress

DataControlBase.GetSelectedRowHandles() Method

wpf-devexpress-dot-xpf-dot-grid-dot-datacontrolbase-eb2fa15f.md

latest3.4 KB
Original Source

DataControlBase.GetSelectedRowHandles() Method

Returns the handles of the selected rows.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public int[] GetSelectedRowHandles()
vb
Public Function GetSelectedRowHandles As Integer()

Returns

TypeDescription
Int32[]

An array of integer values that are handles of the selected rows. An empty array if no rows are selected.

|

Remarks

You can select multiple rows if the DataControlBase.SelectionMode property is set to Row or MultipleRow. You can use the GetSelectedRowHandles method to obtain the handles of the selected rows. Also, the DataControlBase.SelectedItems property returns the collection of currently selected rows/nodes.

When multiple selection is disabled, the GetSelectedRowHandles method returns an array that contains a single element (the focused row handle). You can also use the DataViewBase.FocusedRowHandle property to obtain this value.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetSelectedRowHandles() 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-propertygrid-add-an-item-to-a-collection-or-a-dictionary/CS/MainWindow.xaml.cs#L15

csharp
private void pGrid_CellValueChanged(object sender, DevExpress.Xpf.PropertyGrid.CellValueChangedEventArgs args) {
    var rowhandle = grid.GetSelectedRowHandles()[0];
    grid.RefreshRow(rowhandle);

wpf-propertygrid-add-an-item-to-a-collection-or-a-dictionary/VB/MainWindow.xaml.vb#L17

vb
Private Sub pGrid_CellValueChanged(ByVal sender As Object, ByVal args As CellValueChangedEventArgs)
    Dim rowhandle = Me.grid.GetSelectedRowHandles()(0)
    Me.grid.RefreshRow(rowhandle)

See Also

SelectedItems

SelectionMode

DataControlBase Class

DataControlBase Members

DevExpress.Xpf.Grid Namespace