I am using an UltraExplorerBar with control style OutlookNavigationPane, view style Office2007, and AcceptsFocus equals true. I would like to get similar keyboard behavior for the items to Outlook 2007, where the user can use the arrow keys to select the desired item, and then hit the enter key to commit the selection, which then highlights the active item with a light grey bar. Is there an easy way to get this?
I am using NetAdvantage for .NET 2008 Vol. 2 CLR 2.0.
John
When AcceptsFocus is set to true, and you click on an item, you can then use the arrow keys to navigate the items in that group. Navigating like this causes the ActiveItem to change; by default, the item's appearance does not change except for displaying a focus rectangle. You can use the properties of the UltraExplorerBar.ItemSettings.AppearancesSmall.ActiveAppearance to customize the appearance of these items. When you press the Enter key on the ActiveItem, the ItemClick event is generated.
UltraExplorerBarItems do not support selection in the classic sense, but you could get a look/behavior similar to what you describe here by storing a reference to the last item to be activated, setting the appearance of the newly activated item, and clearing that of the last one activated, as demonstrated by the following code sample:
Infragistics.Win.Appearance selectedItemAppearance = new Infragistics.Win.Appearance();UltraExplorerBarItem lastSelectedItem = null;
this.selectedItemAppearance.BackColor = SystemColors.ControlDark;
this.ultraExplorerBar1.ItemClick += new ItemClickEventHandler(ultraExplorerBar1_ItemClick);
private void ultraExplorerBar1_ItemClick(object sender, ItemEventArgs e){ if ( this.lastSelectedItem != null ) this.lastSelectedItem.Settings.AppearancesSmall.Appearance = null;
this.lastSelectedItem = e.Item; e.Item.Settings.AppearancesSmall.Appearance = this.selectedItemAppearance;}
Also note that some of the navigation panes seen in MS Outlook are actually TreeView controls embedded in the groups; you can emulate this by setting the UltraExplorerBar.GroupSettings.Style to 'ControlContainer', and putting an UltraTree control on the group's control container.