Пример #1
0
        void Test()
        {
            VerifyAccess();
            for (int j = 0; j < 4; j++)
            {
                RtwTreeNode model = new RtwTreeNode("model" + j, false);
                for (int i = 0; i < 4; i++)
                {
                    model.AddChild(new RtwTreeNode("var" + i, false));
                }

                this.Items.Add(model);
            }
        }
Пример #2
0
        /*
         * Boolean _mouseOverDispatched = false;
         * void MouseEnter(Object sender, RoutedEventArgs e)
         * {
         *  _clickSender = sender;
         *  _clickEventArg = e;
         *  DelFunc func = OnMouseOver;
         *  Dispatcher.Invoke(DispatcherPriority.Normal, new Action(func));
         *  if (_mouseOverDispatched == false) OnMouseOver();
         *  _mouseOverDispatched = false;
         * }
         *
         * void OnMouseOver()
         * {
         *  object sender = _clickSender;
         *  RoutedEventArgs e = _clickEventArg;
         *
         *  ContentPresenter p = null;
         *  TreeViewItem item = null;
         *  TreeNode up = null;
         *  try
         *  {
         *      if (e.OriginalSource is TextBlock)
         *      {
         *          //p = (e.OriginalSource as TextBlock).TemplatedParent as ContentPresenter;
         *          p = (e.OriginalSource as TextBlock).TemplatedParent as ContentPresenter;
         *      }
         *      else if (e.OriginalSource is Rectangle)
         *      {
         *          if ((e.OriginalSource as Rectangle).TemplatedParent is ContentPresenter)
         *          {
         *              p = (e.OriginalSource as Rectangle).TemplatedParent as ContentPresenter;
         *          }
         *          else
         *          {
         *              item = (e.OriginalSource as Rectangle).TemplatedParent as TreeViewItem;
         *          }
         *      }
         *      else if(e.OriginalSource is TreeViewItem)
         *      {
         *          item = e.OriginalSource as TreeViewItem;
         *      }else if(e.OriginalSource is TreeView){
         *          TreeView view = (e.OriginalSource as TreeView);
         *      }else{
         *          return;
         *      }
         *      if (item != null)
         *      {
         *          up = item.Header as TreeNode;
         *          (item.Parent as Grid).Children[0].Visibility = System.Windows.Visibility.Hidden;
         *      }
         *      else
         *      {
         *          up = p.Content as TreeNode;
         *          (p.Parent as Grid).Children[0].Visibility = System.Windows.Visibility.Hidden;
         *      }
         *  }
         *  catch
         *  {
         *
         *  }
         *  finally
         *  {
         *      _mouseOverDispatched = true;
         *  }
         * }
         */



        void addItemForTest()
        {
            //VerifyAccess();
            List <RtwTreeNode> newlist = new List <RtwTreeNode>(this.Items);

            for (int j = 0; j < 1; j++)
            {
                RtwTreeNode model = new RtwTreeNode("Tree" + j, false);
                for (int i = 0; i < 2; i++)
                {
                    model.AddChild(new RtwTreeNode("TreeNode" + i, false));
                }

                newlist[0].AddChild(model);
            }
            this.Items = newlist;
        }