Skip to main content
A newer version of this page is available. .

ColumnViewOptionsBehavior.KeepFocusedRowOnUpdate Property

Gets or sets whether the currently focused row retains focus when data is sorted, grouped or filtered or when records are added to/removed from the underlying data source. Disabling this property is in effect when the data source is not managed by the CurrencyManager (see ColumnView.DisableCurrencyManager).

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v18.2.dll

Declaration

[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool KeepFocusedRowOnUpdate { get; set; }

Property Value

Type Default Description
Boolean **true**

true if the currently focused row retains focus when data is sorted, grouped or filtered or when records are added to/removed from the underlying data source; false if the focused row handle (visual position) is kept when these actions are performed.

Property Paths

You can access this nested property as listed below:

Object Type Path to KeepFocusedRowOnUpdate
AdvBandedGridView
.OptionsBehavior.KeepFocusedRowOnUpdate
BandedGridView
.OptionsBehavior.KeepFocusedRowOnUpdate
ColumnView
.OptionsBehavior.KeepFocusedRowOnUpdate
CardView
.OptionsBehavior.KeepFocusedRowOnUpdate
GridView
.OptionsBehavior.KeepFocusedRowOnUpdate
LayoutView
.OptionsBehavior.KeepFocusedRowOnUpdate
TileView
.OptionsBehavior.KeepFocusedRowOnUpdate
WinExplorerView
.OptionsBehavior.KeepFocusedRowOnUpdate

Remarks

Setting the KeepFocusedRowOnUpdate property to false is in effect when the data source is not managed by the CurrencyManager (see ColumnView.DisableCurrencyManager).

If the KeepFocusedRowOnUpdate property is set to false the value of the ColumnView.FocusedRowHandle property is not changed when the data source is modified or when data is sorted, grouped or filtered using the Grid Control UI. Therefore, focus may move to another row when any of these actions is performed.

In the following example, a sample Grid Control displays three records sorted by the ‘Order ID’ column in descending order. The second record (OrderID=10249) is focused.

KeepFocusedRowOnUpdate_Source

Assume that a new row (OrderID=12001) is added to the data source. According to the current sort settings, this row will be positioned above all existing rows, and the currently focused row (OrderID=10249) will be moved down.

If the KeepFocusedRowOnUpdate property is set to true, the currently focused row (OrderID=10249) will remain focused after the new row is inserted:

KeepFocusedRowOnUpdate_True

If the KeepFocusedRowOnUpdate property is set to false the value of the ColumnView.FocusedRowHandle property is not changed after the new row is added. Therefore, the row with OrderID=10250 will be focused.

KeepFocusedRowOnUpdate_False

See Also