Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxGrid.FocusedRowEnabled Property

Specifies whether the row focus is enabled.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(false)]
[Parameter]
public bool FocusedRowEnabled { get; set; }

#Property Value

Type Default Description
Boolean false

true to enable the focused row; otherwise, false.

#Remarks

Set the FocusedRowEnabled property to true to allow the Grid to focus data and group rows. Only one row can be focused at a time within the current page. When a page changes, the row loses focus.

razor
<DxGrid @ref="Grid" FocusedRowEnabled="true" Data="@Products" PageSize="6" >
    <Columns>
        <DxGridDataColumn FieldName="ProductId" />
        <DxGridDataColumn FieldName="ProductName" />
        <DxGridDataColumn FieldName="UnitPrice" />
        <DxGridDataColumn FieldName="UnitsInStock" />
        <DxGridDataColumn FieldName="QuantityPerUnit" />
    </Columns>
</DxGrid>

Blazor Grid Focused Row

Focus can be moved in the following ways:

When the focused row changes, the component raises the FocusedRowChanged event.

Run Demo: Grid - Focused Row View Example: How to display the Chart based on the Grid focus

#Methods Designed to Work With the Focused Row

Data row

GetFocusedRowIndex() - Returns the visible index of the focused row or -1 if the Grid has no data to display.

SetFocusedRowIndex(Int32) - Moves focus to the row with the specified visible index.

IsRowFocused(Int32) - Identifies whether the row with the specified visible index is focused.

GetFocusedDataItem() - Returns the data item bound to the focused data row.

SetFocusedDataItemAsync(Object) - Moves focus to the row bound to the specified data item.

IsDataItemFocused(Object) - Returns whether the row bound to the specified data item is focused.

Group row

A group row has no bound data item, so you can work with a visible index only.

GetFocusedRowIndex() - Returns the visible index of the focused row or -1 if the Grid has no data to display.

SetFocusedRowIndex(Int32) - Moves focus to the row with the specified visible index.

IsRowFocused(Int32) - Identifies whether the row with the specified visible index is focused.

New row

The Grid focuses a new row once it appears. The new row has no bound data item and the row’s visible index equals -1.

IsEditingNewRow() - Identifies whether a new row is being edited.

StartEditNewRowAsync(String) - Shows, focuses, and starts editing a new row.

For more information about row focus in the Grid component, refer to the following topic: Selection and Focus in Blazor Grid.

#Implements

See Also