Skip to main content

OfficeNavigationBar.SynchronizeNavigationClientSelectedItem Event

Allows you to implement your own custom relation between items of this OfficeNavigationBar and items of the child NavBarControl managed by this OfficeNavigationBar.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Navigation Client")]
public event NavigationBarNavigationClientSynchronizeItemEventHandler SynchronizeNavigationClientSelectedItem

Event Data

The SynchronizeNavigationClientSelectedItem event's data class is DevExpress.XtraBars.Navigation.NavigationBarNavigationClientSynchronizeItemEventArgs.

Remarks

When you associate the OfficeNavigationBar with a target navigation control by using the OfficeNavigationBar.NavigationClient property, the OfficeNavigationBar automatically generates items that match items of the associated control. For instance, if you have a Navigation Bar with four groups, the OfficeNavigationBar will receive four items. End-users will be able to click them in order to change which navigation bar group is currently visible. By handling the SynchronizeNavigationClientSelectedItem event, you can remap the relations between OfficeNavigationBar items and items of the associated navigation control. The code below illustrates how to do that for the mentioned example and invert the default relations (for instance, clicking on ‘Group 4’ item will display navigation bar’s ‘Group 1’).

private void OfficeNavigationBar1_SynchronizeNavigationClientSelectedItem(object sender, DevExpress.XtraBars.Navigation.NavigationBarNavigationClientSynchronizeItemEventArgs e) {
    string clickedItem = e.Item.Text;
    switch (clickedItem) {
        case "Group 1": e.Result = navBarGroup4; break;
        case "Group 2": e.Result = navBarGroup3; break;
        case "Group 3": e.Result = navBarGroup2; break;
        case "Group 4": e.Result = navBarGroup1; break;
    }
}
See Also