GridControl.FocusedView Property
Gets or sets the View which is currently focused.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
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 illustrates 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();
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the FocusedView property.
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.