property Grid.EnsureOnSort as Boolean
Specifies whether the control ensures that the focused item fits the control's client area, when the user sorts the items.

TypeDescription
Boolean A boolean expression that indicates whether the control ensures that the focused item fits the control's client area after sorting the items.
By default, the EnsureOnSort property is True. If the EnsureOnSort property is True, the control calls the EnsureVisibleItem method to ensure that the focused item ( FocusItem property ) fits the control's client area, once items get sorted. Use the SortOrder property to sort a column. The SortChildren method sorts child items of an item. The EnsureOnSort property prevents scrolling of the control when child items are sorted.

The following VB sample prevents scrolling the items, when the user calls the SortChildren method:

Private Sub Grid1_BeforeExpandItem(ByVal Item As EXGRIDLibCtl.HITEM, Cancel As Variant)
    With Grid1
        Dim bEnsureOnSort As Boolean
        bEnsureOnSort = .EnsureOnSort
        .EnsureOnSort = False
        .Items.SortChildren Item, 0, False
        .EnsureOnSort = bEnsureOnSort
    End With
End Sub

The sample sorts the child items, when the user expands an item.