Skip to main content
Bar

BarManager.HighlightedLinkChanged Event

Fires immediately after the highlighted link has been changed.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public event HighlightedLinkChangedEventHandler HighlightedLinkChanged

Event Data

The HighlightedLinkChanged event's data class is HighlightedLinkChangedEventArgs. The following properties provide information specific to this event:

Property Description
Link Gets the currently highlighted link.
PrevLink Gets the previously highlighted link.

Remarks

Write a HighlightedLinkChanged event handler to perform specific actions each time the currently highlighted link is changed. The event parameter allows you to determine the previous and currently highlighted link. Note that this event fires when none of links was previously highlighted or when none of them becomes highlighted. The properties representing the currently and previously highlighted links can return null references in such cases.

If you want to determine the currently highlighted link directly from your code, use the BarManager.HighlightedLink property.

Example

The following example shows how to paint hot-tracked bar items using a bold font.

This example contains two separate pieces of code. The first assigns a bold font to the links within the browser bar. This is performed by modifying the BarItem.Appearance property of the associated items. The AppearanceOptions.UseFont option is disabled to prevent bar items from being immediately painted using the assigned font.

using DevExpress.XtraBars; 

barManager1.ForceInitialize();
Font itemFont = new Font(barManager1.GetController().AppearancesBar.ItemsFont, FontStyle.Bold);
foreach (BarItemLink link in barBrowser.ItemLinks) {
   link.Item.Appearance.Font = itemFont;
   link.Item.Appearance.Options.UseFont = false;
}

The next code sample handles the BarManager.HighlightedLinkChanged event. It is used to enable the bold font for hot-tracked items.

The image below display the result of handling the BarManager.HighlightedLinkChanged event. The hot-tracked link is painted using the bold font.

LinkFont - OwnFont

private void barManager1_HighlightedLinkChanged(object sender, 
  DevExpress.XtraBars.HighlightedLinkChangedEventArgs e) {
    if (e.PrevLink != null && e.PrevLink.Bar == barBrowser)
      e.PrevLink.Item.Appearance.Options.UseFont = false;
    if (e.Link != null && e.Link.Bar == barBrowser) 
      e.Link.Item.Appearance.Options.UseFont = true;
}
See Also