'宣言 Public Event AfterNavigation As AfterNavigationEventHandler
public event AfterNavigationEventHandler AfterNavigation
イベント ハンドラが、このイベントに関連するデータを含む、AfterNavigationEventArgs 型の引数を受け取りました。次の AfterNavigationEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
CurrentItem | NavigationToolbar の現在の項目を取得します。 |
Source | ナビゲーションがトリガーされた方法を指定する列挙体を返します。 |
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; }