コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeViewLazyLoadBranchViewModel"/> class.
 /// </summary>
 /// <param name="parent">Parent item in the tree view.</param>
 public TreeViewLazyLoadBranchViewModel(TreeviewBaseViewModel parent)
     : base(parent)
 {
     _hasDummyChildNode = true;
     Children.Add(new TreeviewLeafViewModel(this));
     PropertyChanged += IsExpandedChangedEventHandler;
 }
コード例 #2
0
 /// <summary>
 /// The root node consumes the bubble up and raises the <see cref="ChildPropertyChanged"/>
 /// event.
 /// </summary>
 /// <param name="sender">TreeViewItem doing the change.</param>
 /// <param name="propertyName">Name of the property which has changed.</param>
 public override void BubbleUpOnChildPropertyChanged(TreeviewBaseViewModel sender, string propertyName)
 {
     if (ChildPropertyChanged != null)
     {
         ChildPropertyChanged(sender, new PropertyChangedEventArgs(propertyName));
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComObjectViewModel"/> class.
 /// </summary>
 /// <param name="parent">The parent viewmodel.</param>
 /// <param name="comObj">Com object which is represented in this node.</param>
 /// <param name="title">Title of the node, or null if the title should be generated automatically.</param>
 public ComObjectViewModel(TreeviewBaseViewModel parent, object comObj, Type typ, string title)
     : base(parent)
 {
     _comObj      = comObj;
     _type        = typ;
     Title        = title;
     _description = null;
 }
コード例 #4
0
        private List <TreeviewBaseViewModel> BuildParentList()
        {
            List <TreeviewBaseViewModel> result = new List <TreeviewBaseViewModel>();

            TreeviewBaseViewModel parent = Parent;

            while (parent != null)
            {
                result.Insert(0, parent);
                parent = parent.Parent;
            }
            return(result);
        }
コード例 #5
0
 private void VisitLeafesRecursively(TreeviewBaseViewModel node, List <TreeviewLeafViewModel> result)
 {
     if (node is TreeviewRootViewModel)
     {
         var children = (node as TreeviewRootViewModel).Children;
         foreach (TreeviewBaseViewModel child in children)
         {
             VisitLeafesRecursively(child, result);
         }
     }
     else if (node is TreeviewBranchViewModel)
     {
         var children = (node as TreeviewBranchViewModel).Children;
         foreach (TreeviewBaseViewModel child in children)
         {
             VisitLeafesRecursively(child, result);
         }
     }
     else if (node is TreeviewLeafViewModel)
     {
         result.Add(node as TreeviewLeafViewModel);
     }
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeviewBranchViewModel"/> class.
 /// </summary>
 /// <param name="parent">Parent item in the tree view.</param>
 public TreeviewBranchViewModel(TreeviewBaseViewModel parent)
     : base(parent)
 {
 }