DxTreeList.FocusedRowEnabled Property
Specifies whether row focus is enabled.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(false)]
[Parameter]
public bool FocusedRowEnabled { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Remarks
Set the FocusedRowEnabled
property to true
to allow the TreeList to focus rows. Only one row can be focused at a time within the current page. When the page changes, the row loses focus.
@inject SpaceObjectDataProvider SpaceObjectDataProvider
<DxTreeList Data="TreeListData"
ChildrenFieldName="Satellites"
FocusedRowEnabled="true">
<Columns>
<DxTreeListDataColumn FieldName="Name" />
<DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" />
<DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2">
<HeaderCaptionTemplate>Mass, 10<sup>21</sup> × kg</HeaderCaptionTemplate>
</DxTreeListDataColumn>
</Columns>
</DxTreeList>
@code {
object TreeListData { get; set; }
protected override async Task OnInitializedAsync() {
TreeListData = SpaceObjectDataProvider.GenerateData();
}
}
Focus can be moved in the following ways:
- A user clicks a row.
- You call the SetFocusedRowIndex(Int32) method.
- The TreeList moves focus on the initial load or when visible rows change (for instance, when you apply a filter or sorting, or a page changes).
When the focused row changes, the component raises the FocusedRowChanged event. Use the following methods to work with the focused row:
Method | Description |
---|---|
GetFocusedRowIndex() | Returns the visible index of the focused row. |
SetFocusedRowIndex(Int32) | Moves focus to the row with the specified visible index. |
IsRowFocused(Int32) | Returns whether the row with the specified visible index is focused. |
GetFocusedDataItem() | Returns a data item bound to the focused data row. |
IsDataItemFocused(Object) | Returns whether the row bound to the specified data item is focused. |
For more information about row focus in the TreeList component, refer to the following topic: Selection and Focus in Blazor TreeList.
See Also