Back to Devexpress

GridControl.GetRowHandleByVisibleIndex(Int32) Method

wpf-devexpress-dot-xpf-dot-grid-dot-gridcontrol-dot-getrowhandlebyvisibleindex-x28-system-dot-int32-x29.md

latest5.2 KB
Original Source

GridControl.GetRowHandleByVisibleIndex(Int32) Method

Returns a row’s handle by its visible index.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public int GetRowHandleByVisibleIndex(
    int visibleIndex
)
vb
Public Function GetRowHandleByVisibleIndex(
    visibleIndex As Integer
) As Integer

Parameters

NameTypeDescription
visibleIndexInt32

An integer value that specifies the row’s visible position within a View.

|

Returns

TypeDescription
Int32

An integer value that specifies the handle of the specified row (group or data).

|

Remarks

The GetRowHandleByVisibleIndex method returns InvalidRowHandle if the specified row does not exist.

Refer to the following help topics for more information: Identify Rows and Cards and Obtain Row Handles.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetRowHandleByVisibleIndex(Int32) 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-expand-and-collapse-master-rows/CS/WpfApplication21/MainWindow.xaml.cs#L32

csharp
for (int i = 0; i < grid.VisibleRowCount; i++) {
    var rowHandle = grid.GetRowHandleByVisibleIndex(i);
    grid.ExpandMasterRow(rowHandle);

wpf-data-grid-obtain-rows-visible-on-screen/CS/IScrollInfoSample/Window1.xaml.cs#L28

csharp
for (int i = grid.View.TopRowIndex; i < bottomIndex; i++) {
    var handle = grid.GetRowHandleByVisibleIndex(i);
    if (!grid.IsValidRowHandle(handle))

how-to-create-search-window-with-find-previous-and-find-next-buttons-in-gridcontrol-t127527/CS/DevExpress.Example01/SearchBehavior/SearchWindow.xaml.cs#L230

csharp
while(++i < this._Grid.VisibleRowCount) {
    int rowHandle = this._Grid.GetRowHandleByVisibleIndex(i);
    if(this._Grid.IsGroupRowHandle(rowHandle)) {

wpf-data-grid-expand-and-collapse-master-rows/VB/WpfApplication21/MainWindow.xaml.vb#L31

vb
For i As Integer = 0 To Me.grid.VisibleRowCount - 1
    Dim rowHandle = Me.grid.GetRowHandleByVisibleIndex(i)
    Me.grid.ExpandMasterRow(rowHandle)

wpf-data-grid-obtain-rows-visible-on-screen/VB/IScrollInfoSample/Window1.xaml.vb#L29

vb
For i As Integer = Me.grid.View.TopRowIndex To bottomIndex - 1
    Dim handle = Me.grid.GetRowHandleByVisibleIndex(i)
    If Not Me.grid.IsValidRowHandle(handle) Then Continue For

how-to-create-search-window-with-find-previous-and-find-next-buttons-in-gridcontrol-t127527/VB/DevExpress.Example01/SearchBehavior/SearchWindow.xaml.vb#L224

vb
While Threading.Interlocked.Increment(i) < _Grid.VisibleRowCount
    Dim rowHandle As Integer = _Grid.GetRowHandleByVisibleIndex(i)
    If _Grid.IsGroupRowHandle(rowHandle) Then

See Also

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace