Version

Navigate to a New Location

You can populate WinNavigationBar™ Locations either by fully loading the collection when the form loads, or dynamically as the end user browses through the collection. When you fully load the collection, you can programmatically navigate to one of these locations by calling the NavigateTo method. Simply pass the path that you need to navigate to as an argument. WinNavigationBar will parse the path and find a location that matches each item along the path. If WinNavigationBar can’t find a matching location for one of the items, it fires the NavigationPathParseError event. If the parse succeeds, the SelectedLocationChanging and SelectedLocationChanged events fire in order.

If you decide to lazily populate WinNavigationBar’s Locations, you should be cautious as to which path you pass in to the NavigateTo method, as it is possible that path won’t exist yet. The best practice for lazily populating WinNavigationBar is to use the InitializeLocations event. InitializeLocations fires the first time you access an individual location. You can populate the location’s children based on the EventArgs.ParentLocation object. For more information on lazily populating WinNavigationBar, see Lazily Populate WinNavigationBar.

The following code will navigate to a location representing the "C:\Program Files" folder.

In Visual Basic:

Me.UltraNavigationBar1.NavigateTo("C:\Program Files", True)

In C#:

this.ultraNavigationBar1.NavigateTo("C:\\Program Files", true);