Esempio n. 1
0
        public void GoBack()
        {
            String nodePath = BackStack.Pop();

            if (!String.IsNullOrEmpty(nodePath))
            {
                if (_treeView.SelectedItem != null)
                {
                    ForwardStack.Push(_treeView.SelectedItem.Path);
                }

                ShouldAddToStack = false;
                _treeView.ShowNode(nodePath);
            }
        }
Esempio n. 2
0
 private void btnGo_Click(object sender, RoutedEventArgs e)
 {
     if (dgNodes.SelectedItem != null)
     {
         //先保存原有的节点数据
         if (_tree.SelectedItem != null)
         {
             _tree.SelectedItem.NodeData.DataItem.RefreshMe();
             //当前节点如果是OnlyText时,其AccessObj==null,此时不应该更新底层存储
             if (_tree.SelectedItem.NodeData.AccessObject != null)
             {
                 try
                 {
                     _tree.SelectedItem.NodeData.AccessObject.UpdateDataInfoObject(_tree.SelectedItem.NodeData.DataItem);
                 }
                 catch (Exception ex)
                 {
                     Dispatcher.Invoke(new Action(() => { MessageBox.Show(ex.ToString()); }));
                 }
             }
         }
         //显示新数据
         TreeViewIconsItem node = dgNodes.SelectedItem as TreeViewIconsItem;
         _tree.ShowNode(node.Path);
         //如果当前节点不可视,则滚动显示它!
         node.BringIntoView();
     }
 }