Version

AfterNavigation Event

Occurs after an item has been navigated to on the navigation toolbar.
Syntax
'Declaration
 
Public Event AfterNavigation As AfterNavigationEventHandler
public event AfterNavigationEventHandler AfterNavigation
Event Data

The event handler receives an argument of type AfterNavigationEventArgs containing data related to this event. The following AfterNavigationEventArgs properties provide information specific to this event.

PropertyDescription
CurrentItem Gets the current item of the NavigationToolbar.
Source Returns an enum specifying how the navigation has been triggered.
Example
The following snippet handles an UltraTree's AfterSelect event to add the node to the navigation history so that the two elements can be in sync.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win.UltraWinTree

Private isNodeSelectedFromNavigationToolbar As Boolean

' Handles the UltraTree's AfterSelect event
Private Sub tvwFolders_AfterSelect(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinTree.SelectEventArgs) Handles tvwFolders.AfterSelect
	Dim selectedNode As UltraTreeNode = IIf(e.NewSelections.Count = 1, e.NewSelections(0), Nothing)
	If (selectedNode Is Nothing) Then Return

	'	Make sure that this node's Nodes collection is populated so
	'	that if the end user double-clicks on an item, we will be able
	'	to locate the associated sub-directory.
   Me.PopulateNodesCollection(selectedNode)

	'	Populate the UltraListView with the sub-folders and files 
	'	for the directory associated with the node that was selected
	Me.PopulateListView(selectedNode)

	' Update the current navigation item to the node that we've now selected, assuming
	' that the tree was navigated directly and not through the navigation history of the
	' NavigationToolbar.
	If Me.isNodeSelectedFromNavigationToolbar = False Then
		'We only want to show the text in the drop-down menu, but store the node itself in the
		' Tag property of a NavigationHistoryItem so that we have easy access to it later should
		' the user traverse the navigation history.
		Me.UltraToolbarsManager1.NavigationToolbar.NavigateTo(selectedNode.Text, selectedNode)
	End If
End Sub

' Handles the UltraToolbarsManager's AfterNavigation event.
Private Sub UltraToolbarsManager1_AfterNavigation(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinToolbars.AfterNavigationEventArgs) Handles UltraToolbarsManager1.AfterNavigation
	' Set a flag so that we know that we shouldn't add a new item to the navigation history.
	Me.isNodeSelectedFromNavigationToolbar = True

	' Since we've stored each node in the Tag property of a NavigationHistoryItem, we can now
	' easily select that node now.
	CType(e.CurrentItem.Tag, UltraTreeNode).Selected = True            

	' Reset the flag to allow subseqent additions to the navigation history.
	Me.isNodeSelectedFromNavigationToolbar = False
End Sub
using Infragistics.Win.UltraWinTree;

private bool isNodeSelectedFromNavigationToolbar;

/// <summary>
/// Handles the UltraTree's AfterSelect event
/// </summary>
private void tvwFolders_AfterSelect(object sender, SelectEventArgs e)
{
	// Update the current navigation item to the node that we've now selected, assuming
	// that the tree was navigated directly and not through the navigation history of the
	// NavigationToolbar.
	if(!this.isNodeSelectedFromNavigationToolbar)               
		// We only want to show the text in the drop-down menu, but store the node itself in the
		// Tag property of a NavigationHistoryItem so that we have easy access to it later should
		// the user traverse the navigation history.
		this.ultraToolbarsManager1.NavigationToolbar.NavigateTo(selectedNode.Text, selectedNode);
}

/// <summary>
/// Handles the UltraToolbarsManager's AfterNavigation event.
/// </summary>
private void ultraToolbarsManager1_AfterNavigation(object sender, Infragistics.Win.UltraWinToolbars.AfterNavigationEventArgs e)
{
    // Set a flag so that we know that we shouldn't add a new item to the navigation history.
    this.isNodeSelectedFromNavigationToolbar = true;

    // Since we've stored each node in the Tag property of a NavigationHistoryItem, we can now
    // easily select that node now.
    ((UltraTreeNode)e.CurrentItem.Tag).Selected = true;

    // Reset the flag to allow subseqent additions to the navigation history.
    this.isNodeSelectedFromNavigationToolbar = false;
}
Requirements

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

See Also