BarItemLink.Focus() Method

Moves focus to the link.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v20.1.dll


public virtual void Focus()
Public Overridable Sub Focus


Use the Focus method to move focus to the link. Such a link is highlighted according to the current paint scheme.

You are not able to move focus to a link currently hidden, for example, in the popup menu. To open a menu for a container item, you can call the BarCustomContainerItemLink.OpenMenu method. To open the popup menu, call PopupMenu.ShowPopup.


The following example shows how you can focus a specific subitem within a container item.

The menu for the mFile item of the BarSubItem class is activated. To do this, the BarCustomContainerItemLink.OpenMenu method is called.

After the menu is opened, we focus the first subitem in it using the BarItemLink.Focus method.

The result is shown below:


// The item and its link for which the menu should be opened
BarSubItem containerItem = mFile;
BarSubItemLink containerLink = containerItem.Links[0] as BarSubItemLink;
// Open the menu for the link
// Focus the first link in the menu opened
See Also