Back to Devexpress

GridControl.IsValidRowHandle(Int32) Method

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

latest3.9 KB
Original Source

GridControl.IsValidRowHandle(Int32) Method

Indicates whether the specified row handle is valid.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public bool IsValidRowHandle(
    int rowHandle
)
vb
Public Function IsValidRowHandle(
    rowHandle As Integer
) As Boolean

Parameters

NameTypeDescription
rowHandleInt32

An integer value that specifies the row’s handle.

|

Returns

TypeDescription
Boolean

true if the specified row handle is valid; otherwise, false.

|

Remarks

An invalid row handle corresponds to a row which doesn’t exist in a View. Its handle is returned by the DataControlBase.InvalidRowHandle property. To learn more, see Identifying Rows and Cards.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsValidRowHandle(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-obtain-rows-visible-on-screen/CS/IScrollInfoSample/Window1.xaml.cs#L29

csharp
var handle = grid.GetRowHandleByVisibleIndex(i);
if (!grid.IsValidRowHandle(handle))
    continue;

wpf-grid-sync-isnodeexpanded-with-view-model/CS/DevExpress.Example04/BindableExpandingBehavior.cs#L99

csharp
bool isExpanded = (bool)obj.GetType().GetProperty(args.PropertyName).GetValue(obj, null);
if(this.AssociatedObject.IsValidRowHandle(rowHandle)) {
    node.IsExpanded = isExpanded;

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

vb
Dim handle = Me.grid.GetRowHandleByVisibleIndex(i)
If Not Me.grid.IsValidRowHandle(handle) Then Continue For
Dim item = TryCast(Me.grid.GetRow(handle), Item)

wpf-grid-sync-isnodeexpanded-with-view-model/VB/DevExpress.Example04/BindableExpandingBehavior.vb#L101

vb
Dim isExpanded As Boolean = CBool(obj.GetType().GetProperty(args.PropertyName).GetValue(obj, Nothing))
If Me.AssociatedObject.IsValidRowHandle(rowHandle) Then
    node.IsExpanded = isExpanded

See Also

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace