GridControl.FocusedView Property

Gets or sets the View which is currently focused.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[Browsable(false)]
public BaseView FocusedView { get; set; }
<Browsable(False)>
Public Property FocusedView As BaseView

Property Value

Type Description
BaseView

A BaseView descendant which represents the focused View.

Remarks

When the grid control is working in master-detail mode, it can display a number of Views simultaneously. For instance, it can display the main View together with expanded detail clones. The FocusedView property can be used to determine which View currently has focus. Setting this property moves focus to the specified View. To specify the focused cell within a View use the ColumnView.FocusedColumn and ColumnView.FocusedRowHandle properties.

The FocusedView property merely indicates the internal grid control's focus position. To determine whether the grid control is focused read its GridControl.IsFocused property's value. Whether a particular View has focus can be determined by inspecting the BaseView.IsFocusedView property's value.

When moving focus between the Views the GridControl.FocusedViewChanged event is raised. When a View receives or loses focus, the BaseView.GotFocus and BaseView.LostFocus events are raised, respectively.

Example

The code below illstrates how to obtain the value of a currently edited cell.

using DevExpress.XtraGrid.Views.Base;

ColumnView view = gridControl1.FocusedView as ColumnView;
string editingValue = null;
if (view != null && view.IsEditing)
    editingValue = view.EditingValue.ToString();
See Also