Note: Changing the value of the Path property has no effect when the event fires as the result of the Infragistics.Win.Misc.UltraNavigationBar.NavigateTo method being called.
Note: Setting the Path property to a new value is only applicable when the StayInEditMode property is set to true.
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 Imports System.Text ' <summary> ' Handles the UltraNavigationBar's 'NavigationPathParseError' event. ' </summary> Private Sub OnNavigationBarNavigationPathParseError(ByVal sender As Object, ByVal e As NavigationPathParseErrorEventArgs) Dim navigationPath As String = e.Path Dim navigationBar As UltraNavigationBar = sender Dim pathSeparator As String = navigationBar.PathSeparator ' Separate each node in the path by splitting on the path separator Dim locations As String() = navigationPath.Split(navigationBar.PathSeparator.ToCharArray()) ' Iterate the array, and attempt to parse the path starting at the highest ' level ancestor. Continue until the parsing operation fails, and set the ' new path to the closest valid one we can get. Dim ancestorPath As StringBuilder = New StringBuilder(navigationPath.Length) Dim lastValidLocation As UltraNavigationBarLocation = Nothing Dim i As Integer For i = 0 To locations.Length - 1 ' Append the new node text to the parse string ancestorPath.Append(String.Format("{0}{1}", locations(i), pathSeparator)) ' Use the UltraNavigationBar's FromFullPath method to parse the path Dim location As UltraNavigationBarLocation = navigationBar.FromFullPath(ancestorPath.ToString()) If location Is Nothing Then Continue For lastValidLocation = location Next ' If we were able to make some sense out of the string the end user typed, ' set the Path property of the event arguments to the resulting path. If Not lastValidLocation Is Nothing Then e.Path = lastValidLocation.GetFullPath(FullPathFormat.EditMode) 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; using System.Text; /// <summary> /// Handles the UltraNavigationBar's 'NavigationPathParseError' event. /// </summary> private void OnNavigationBarNavigationPathParseError(object sender, NavigationPathParseErrorEventArgs e) { string navigationPath = e.Path; UltraNavigationBar navigationBar = sender as UltraNavigationBar; string pathSeparator = navigationBar.PathSeparator; // Separate each node in the path by splitting on the path separator string[] locations = navigationPath.Split( navigationBar.PathSeparator.ToCharArray() ); // Iterate the array, and attempt to parse the path starting at the highest // level ancestor. Continue until the parsing operation fails, and set the // new path to the closest valid one we can get. StringBuilder ancestorPath = new StringBuilder(navigationPath.Length); UltraNavigationBarLocation lastValidLocation = null; for ( int i = 0; i < locations.Length; i ++ ) { // Append the new node text to the parse string ancestorPath.Append( string.Format("{0}{1}", locations[i], pathSeparator) ); // Use the UltraNavigationBar's FromFullPath method to parse the path UltraNavigationBarLocation location = navigationBar.FromFullPath( ancestorPath.ToString() ); if ( location == null ) break; lastValidLocation = location; } // If we were able to make some sense out of the string the end user typed, // set the Path property of the event arguments to the resulting path. if ( lastValidLocation != null ) e.Path = lastValidLocation.GetFullPath( FullPathFormat.EditMode ); }
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