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

TdxNavBarViewsFactory.IndexOfName(string) Method

Returns the index of the NavBar control View by its name.

#Declaration

Delphi
function IndexOfName(const Name: string): Integer;

#Parameters

Name Type
Name string

#Returns

Type
Integer

#Remarks

The Name parameter specifies the View’s name. If a View with the specified name is not registered within the NavBar control, the IndexOfName function returns -1.

A View for painting the NavBar control is specified via the View property. This property specifies the identity value of the required View. If you want to set a View by its name, use the IndexOfName method to obtain the corresponding View index first.

The following code applies the ExplorerBarView View to the NavBar control:

Delphi
dxNavBar1.View := dxNavBarViewsFactory.IDs[dxNavBarViewsFactory.IndexOfName('ExplorerBarView')];

The following code does the same:

Delphi
dxNavBar1.View := dxNavBarViewsFactory.GetIDFromName('ExplorerBarView');
See Also