How to: Cancel item selection
In this example, the NavBarViewBase.ItemSelecting event is handled, to invoke a confirmation dialog allowing the selection of a specific item (‘Private’) to be canceled.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-programmatically-create-a-navbarcontrol-with-groups-and-items-e1626.
private void navBar_ItemSelecting(object sender, NavBarItemSelectingEventArgs e){
if (e.NewItem.Content.ToString() == "Private"){
MessageBoxResult result = MessageBox.Show("Are you sure to select the 'Private' item?", "Confirm Dialog", MessageBoxButton.YesNo);
e.Cancel = (result == MessageBoxResult.No);
}
}