Edit mode is entered when the end user clicks the area between the SelectedLocation and the previous locations dropdown button. Prior to entering edit mode, the EnteringEditMode event is fired; if the event is canceled, no edit mode session is initiated, and no further action takes place. If the EnteringEditMode event is not canceled, the Editor appears in the area where the navigation path usually appears, and the EnteredEditMode event is fired. When the end user commits the result of the edit mode session, (i.e., presses the Enter key as opposed to the Escape key), the ExitingEditMode event is fired. If the ExitingEditMode event is not canceled, the text typed by the end user is parsed into a navigation path; if this parsing operatrion is successful, the resulting location is assigned to the SelectedLocation property. If the parsing operation is not successful, the NavigationPathParseError event is fired, and a MessageBox is displayed to the end user reporting the failure. If the value of the Infragistics.Win.Misc.UltraWinNavigationBar.ExitingEditModeEventArgs.AddToPreviousLocations property is set to true, the new SelectedLocation is inserted at the first position of the PreviousLocations collection. The ExitedEditMode event is then fired.
Note: The UltraNavigationBar uses the Infragistics.Win.EditorWithCombo editor for in-place editing.
Imports System Imports System.Drawing Imports System.IO Imports System.Collections.Generic Imports System.ComponentModel Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.Misc Imports Infragistics.Win.Misc.UltraWinNavigationBar ' <summary> ' Adds key-action mappings for the specified UltraNavigationBar which will ' cause it to enter edit mode if the F2 key is pressed when the control is ' not in edit mode, or exit edit mode and commit changes if the control is ' in edit mode. ' </summary> ' <param name="navigationBar">The associated UltraNavigationBar control.</param> Private Sub AddEditModeKeyMappings(ByVal navigationBar As UltraNavigationBar) Dim noState As UltraNavigationBarStates = UltraNavigationBarStates.None Dim isInEditModeState As UltraNavigationBarStates = UltraNavigationBarStates.InEditMode ' Add the 'EnterEditMode' action with no required state, and a disallowed ' state of 'InEditMode'. Me.AddKeyMapping(navigationBar, Keys.F2, UltraNavigationBarAction.EnterEditMode, noState, isInEditModeState) ' Add the 'ExitEditModeCommit' action with no disallowed state, and a required ' state of 'InEditMode', i.e., the opposite of the previous mapping Me.AddKeyMapping(navigationBar, Keys.F2, UltraNavigationBarAction.ExitEditModeCommit, isInEditModeState, noState) End Sub ' <summary> ' Adds a key-action mapping to the specified UltraNavigationBar for the ' specified key/action combination ' </summary> ' <param name="navigationBar">The associated UltraNavigationBar control.</param> ' <param name="keyCode">The Keys constant which defines the keystroke.</param> ' <param name="actionCode">The UltraNavigationBarAction constant which defines the action to be performed when the key is pressed.</param> ' <param name="requiredState">The UltraNavigationBarStates value which defines the state(s) the control must be in for the action to be performed.</param> ' <param name="disallowedState">The UltraNavigationBarStates value which defines the state(s) the control must not be in for the action to be performed.</param> Private Sub AddKeyMapping(ByVal navigationBar As UltraNavigationBar, _ ByVal keyCode As Keys, _ ByVal actionCode As UltraNavigationBarAction, _ ByVal requiredStates As UltraNavigationBarStates, _ ByVal disallowedStates As UltraNavigationBarStates) ' First see if there is already a mapping for the specified key/action combination ' if there is, don't add this one or they could potentially contradict each other. Dim keyMappings As UltraNavigationBarKeyActionMappings = navigationBar.KeyActionMappings Dim i As Integer For i = 0 To keyMappings.Count - 1 Dim keyMapping As UltraNavigationBarKeyActionMapping = keyMappings(i) If (keyMapping.ActionCode = actionCode AndAlso keyMapping.KeyCode = keyCode) Then Return End If Next ' Add the key-action mapping. keyMappings.Add(New UltraNavigationBarKeyActionMapping(keyCode, actionCode, disallowedStates, requiredStates, SpecialKeys.All, 0)) End Sub ' <summary> ' Handles the UltraNavigationBar's 'ActionButtonClicked' event. ' </summary> Private Sub OnNavigationBarActionButtonClicked(ByVal sender As Object, ByVal e As ActionButtonEventArgs) ' Enter/exit edit mode when this button is clicked. If e.Button.Key = "Edit" Then Dim navigationBar As UltraNavigationBar = sender If (navigationBar.IsInEditMode) Then navigationBar.ExitEditMode(True) Else navigationBar.EnterEditMode() End If End If End Sub
using System; using System.Drawing; using System.IO; using System.Collections.Generic; using System.ComponentModel; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.Misc; using Infragistics.Win.Misc.UltraWinNavigationBar; /// <summary> /// Adds key-action mappings for the specified UltraNavigationBar which will /// cause it to enter edit mode if the F2 key is pressed when the control is /// not in edit mode, or exit edit mode and commit changes if the control is /// in edit mode. /// </summary> /// <param name="navigationBar">The associated UltraNavigationBar control.</param> private void AddEditModeKeyMappings( UltraNavigationBar navigationBar ) { UltraNavigationBarStates noState = UltraNavigationBarStates.None; UltraNavigationBarStates isInEditModeState = UltraNavigationBarStates.InEditMode; // Add the 'EnterEditMode' action with no required state, and a disallowed // state of 'InEditMode'. this.AddKeyMapping( navigationBar, Keys.F2, UltraNavigationBarAction.EnterEditMode, noState, isInEditModeState ); // Add the 'ExitEditModeCommit' action with no disallowed state, and a required // state of 'InEditMode', i.e., the opposite of the previous mapping this.AddKeyMapping( navigationBar, Keys.F2, UltraNavigationBarAction.ExitEditModeCommit, isInEditModeState, noState ); } /// <summary> /// Adds a key-action mapping to the specified UltraNavigationBar for the /// specified key/action combination /// </summary> /// <param name="navigationBar">The associated UltraNavigationBar control.</param> /// <param name="keyCode">The Keys constant which defines the keystroke.</param> /// <param name="actionCode">The UltraNavigationBarAction constant which defines the action to be performed when the key is pressed.</param> /// <param name="requiredState">The UltraNavigationBarStates value which defines the state(s) the control must be in for the action to be performed.</param> /// <param name="disallowedState">The UltraNavigationBarStates value which defines the state(s) the control must not be in for the action to be performed.</param> private void AddKeyMapping( UltraNavigationBar navigationBar, Keys keyCode, UltraNavigationBarAction actionCode, UltraNavigationBarStates requiredStates, UltraNavigationBarStates disallowedStates ) { // First see if there is already a mapping for the specified key/action combination; // if there is, don't add this one or they could potentially contradict each other. UltraNavigationBarKeyActionMappings keyMappings = navigationBar.KeyActionMappings; for ( int i = 0; i < keyMappings.Count; i ++ ) { UltraNavigationBarKeyActionMapping keyMapping = keyMappings[i]; if ( keyMapping.ActionCode == actionCode && keyMapping.KeyCode == keyCode ) return; } // Add the key-action mapping. keyMappings.Add( new UltraNavigationBarKeyActionMapping(keyCode, actionCode, disallowedStates, requiredStates, SpecialKeys.All, 0) ); } /// <summary> /// Handles the UltraNavigationBar's 'ActionButtonClicked' event. /// </summary> private void OnNavigationBarActionButtonClicked(object sender, ActionButtonEventArgs e) { // Enter/exit edit mode when this button is clicked. if ( e.Button.Key == "Edit" ) { UltraNavigationBar navigationBar = sender as UltraNavigationBar; if ( navigationBar.IsInEditMode ) navigationBar.ExitEditMode( true ); else navigationBar.EnterEditMode(); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
UltraNavigationBar Class
UltraNavigationBar Members
EnterEditMode Method
ExitEditMode Method
EnteringEditMode Event
EnteredEditMode Event
ExitingEditMode Event
ExitedEditMode Event
Editor Property
Infragistics.Win.EditorWithCombo