Example #1
0
 public override void Collapse(RadTreeNode node)
 {
     if (node.Nodes.Count == 0)
     {
         this.UpdateViewOnExpandChanged(node);
     }
     else
     {
         List <TreeNodeElement> associatedNodes = this.GetAssociatedNodes(node);
         for (int index = associatedNodes.Count - 1; index >= 0; --index)
         {
             TreeNodeElement             treeNodeElement         = associatedNodes[index];
             TreeAnimatedPropertySetting animatedPropertySetting = new TreeAnimatedPropertySetting(VisualElement.OpacityProperty, (object)1.0, (object)1.0, 4, 40);
             animatedPropertySetting.StartValue      = (object)1.0;
             animatedPropertySetting.EndValue        = (object)0.0;
             animatedPropertySetting.ApplyEasingType = RadEasingType.Linear;
             if (index == 0)
             {
                 animatedPropertySetting.AnimationFinished += new AnimationFinishedEventHandler(this.AnimatedCollapse_Finished);
                 animatedPropertySetting.Node = node;
             }
             animatedPropertySetting.ApplyValue((RadObject)treeNodeElement);
         }
     }
 }
        protected virtual void PrepareDragHint(TreeNodeElement nodeElement)
        {
            RadTreeViewElement treeViewElement = nodeElement.TreeViewElement;
            Bitmap             bitmap          = (Bitmap)null;
            Size size = Size.Empty;

            if (this.dropHintColor != Color.Empty)
            {
                size   = new Size(this.GetDropHintWidth(treeViewElement), 1);
                bitmap = new Bitmap(size.Width, size.Height);
                using (Graphics graphics = Graphics.FromImage((Image)bitmap))
                {
                    using (SolidBrush solidBrush = new SolidBrush(this.DropHintColor))
                        graphics.FillRectangle((Brush)solidBrush, new Rectangle(Point.Empty, size));
                }
            }
            else if (treeViewElement.ItemDropHint != null)
            {
                size   = new Size(this.GetDropHintWidth(treeViewElement), treeViewElement.ItemDropHint.Image.Size.Height);
                bitmap = new Bitmap(size.Width, size.Height);
                using (Graphics g = Graphics.FromImage((Image)bitmap))
                    treeViewElement.ItemDropHint.Paint(g, new RectangleF(PointF.Empty, (SizeF)size));
            }
            if (bitmap == null)
            {
                return;
            }
            this.dropHintWindow = new RadLayeredWindow();
            this.dropHintWindow.BackgroundImage = (Image)bitmap;
        }
Example #3
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            BaseSpinEditorElement editorElement = this.EditorElement as BaseSpinEditorElement;
            TreeNodeElement       ownerElement  = this.OwnerElement as TreeNodeElement;

            if (ownerElement == null)
            {
                return;
            }
            switch (e.KeyCode)
            {
            case Keys.Return:
                if (e.Modifiers == Keys.Control)
                {
                    break;
                }
                editorElement.Validate();
                ownerElement.TreeViewElement.EndEdit();
                break;

            case Keys.Escape:
                ownerElement.TreeViewElement.CancelEdit();
                break;

            case Keys.Delete:
                if (this.selectionLength != editorElement.TextBoxItem.TextLength)
                {
                    break;
                }
                editorElement.Text = (string)null;
                break;
            }
        }
Example #4
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            BaseSpinEditorElement editorElement = this.EditorElement as BaseSpinEditorElement;

            TreeNodeElement treeNodeElement = this.OwnerElement as TreeNodeElement;

            if (treeNodeElement != null)
            {
                switch (e.KeyCode)
                {
                case Keys.Return:
                    if (e.Modifiers != Keys.Control)
                    {
                        editorElement.Validate();
                        treeNodeElement.TreeViewElement.EndEdit();
                    }
                    break;

                case Keys.Escape:
                    treeNodeElement.TreeViewElement.CancelEdit();
                    break;

                case Keys.Delete:
                    if (selectionLength == editorElement.TextBoxItem.TextLength)
                    {
                        editorElement.Text = null;
                    }
                    break;
                }
            }
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            TreeNodeElement ownerElement = this.OwnerElement as TreeNodeElement;

            if (ownerElement == null)
            {
                return;
            }
            if (e.KeyCode == Keys.Return)
            {
                ownerElement.TreeViewElement.EndEdit();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                ownerElement.TreeViewElement.CancelEdit();
            }
            else
            {
                base.OnKeyDown(e);
            }
        }
        protected override void HandleMouseMove(Point mousePosition)
        {
            base.HandleMouseMove(mousePosition);

            if (this.Initialized)
            {
                TreeNodeElement draggedNodeElement = this.Context as TreeNodeElement;

                if (draggedNodeElement != null)
                {
                    this.owner.OnItemDrag(new RadTreeViewEventArgs(draggedNodeElement.Data));
                }
            }

            ISupportDrop    dropTarget  = this.DropTarget;
            TreeNodeElement nodeElement = dropTarget as TreeNodeElement;

            if (nodeElement == null || !this.CanShowDropHint(mousePosition) || !this.CanCommit)
            {
                this.DisposeHint();
                return;
            }

            if (this.dropHintWindow == null)
            {
                this.PrepareDragHint(nodeElement);
            }

            if (this.dropHintWindow != null)
            {
                this.UpdateHintPosition(mousePosition);
            }
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            TreeNodeElement nodeElement = this.OwnerElement as TreeNodeElement;

            if (nodeElement != null)
            {
                switch (e.KeyCode)
                {
                case Keys.Escape:
                    nodeElement.TreeViewElement.CancelEdit();
                    break;

                case Keys.Enter:
                    nodeElement.TreeViewElement.EndEdit();
                    break;

                case Keys.Up:
                    if (!this.Multiline || (selectionLength == 0 && isAtFirstLine))
                    {
                        nodeElement.TreeViewElement.EndEdit();
                        nodeElement.TreeViewElement.ProcessKeyDown(e);
                    }
                    break;

                case Keys.Down:
                    if (!this.Multiline || (selectionLength == 0 && isAtLastLine))
                    {
                        nodeElement.TreeViewElement.EndEdit();
                        nodeElement.TreeViewElement.ProcessKeyDown(e);
                    }
                    break;
                }
            }
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            BaseDropDownListEditorElement editorElement = this.EditorElement as BaseDropDownListEditorElement;

            this.selectionStart = editorElement.SelectionStart;

            TreeNodeElement nodeElement = this.OwnerElement as TreeNodeElement;

            if (nodeElement != null)
            {
                if (e.KeyCode == Keys.Enter && e.Modifiers != Keys.Control)
                {
                    nodeElement.TreeViewElement.EndEdit();
                }
                else if (e.KeyCode == Keys.Escape)
                {
                    nodeElement.TreeViewElement.CancelEdit();
                    e.Handled = true;
                }
                else if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right)
                {
                    e.Handled = true;
                }
                else if (e.KeyCode == Keys.Down && e.Modifiers == Keys.Alt)
                {
                    ((RadDropDownListElement)this.EditorElement).ShowPopup();
                    e.Handled = true;
                }
            }
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);
            TreeNodeElement ownerElement = this.editor.OwnerElement as TreeNodeElement;

            if (ownerElement != null)
            {
                if (e.KeyCode == Keys.Return)
                {
                    ownerElement.TreeViewElement.EndEdit();
                }
                else if (e.KeyCode == Keys.Escape)
                {
                    ownerElement.TreeViewElement.CancelEdit();
                }
            }
            if (e.KeyCode == Keys.Space)
            {
                this.editor.ToggleState();
            }
            else if (e.KeyCode != Keys.Left && e.KeyCode != Keys.Right)
            {
                this.editor.RaiseKeyDown(e);
            }
            this.downKeyCode = e.KeyCode;
        }
        public override void Collapse(RadTreeNode node)
        {
            if (node.Nodes.Count == 0)
            {
                this.UpdateViewOnExpandChanged(node);
                return;
            }

            List <TreeNodeElement> children = this.GetAssociatedNodes(node);

            for (int i = children.Count - 1; i >= 0; i--)
            {
                TreeNodeElement child = children[i];

                TreeAnimatedPropertySetting animatedCollapse = new TreeAnimatedPropertySetting(RadItem.OpacityProperty,
                                                                                               (double)1, (double)1, 4, 40);
                animatedCollapse.StartValue        = (double)1.0;
                animatedCollapse.EndValue          = (double)0.0;
                animatedCollapse.ApplyEasingType   = RadEasingType.Linear;
                animatedCollapse.UnapplyEasingType = RadEasingType.Linear;

                if (i == 0)
                {
                    animatedCollapse.AnimationFinished += new AnimationFinishedEventHandler(AnimatedCollapse_Finished);
                    animatedCollapse.Node = node;
                }

                animatedCollapse.ApplyValue(child);
            }
        }
Example #11
0
        protected virtual void OnKeyUp(KeyEventArgs e)
        {
            BaseSpinEditorElement editorElement = this.EditorElement as BaseSpinEditorElement;

            TreeNodeElement treeNodeElement = this.OwnerElement as TreeNodeElement;

            if (treeNodeElement != null)
            {
                switch (e.KeyCode)
                {
                case Keys.Right:
                    if ((RightToLeft && selectionStart == 0) || (!RightToLeft && selectionStart == editorElement.Text.Length))
                    {
                        editorElement.Validate();
                    }
                    break;

                case Keys.Left:
                    if ((RightToLeft && selectionStart == editorElement.Text.Length) || (!RightToLeft && selectionStart == 0 && selectionLength == 0))
                    {
                        editorElement.Validate();
                    }
                    break;
                }
            }
        }
        protected virtual void PerformDragDrop(Point dropLocation, TreeNodeElement targetNodeElement, List <RadTreeNode> draggedNodes)
        {
            RadTreeNode  targetNode = targetNodeElement.Data;
            DropPosition position   = this.GetDropPosition(dropLocation, targetNodeElement);

            if (position == DropPosition.AsChildNode)
            {
                foreach (RadTreeNode node in draggedNodes)
                {
                    if (!this.OnDragEnding(position, node, targetNode))
                    {
                        continue;
                    }

                    node.Remove();
                    targetNode.Nodes.Add(node);
                    this.owner.OnDragEnded(new RadTreeViewDragEventArgs(node, targetNode));
                }

                targetNode.Expand();
            }
            else
            {
                this.PerformDragDropCore(position, targetNode, draggedNodes);
            }
        }
        protected override void PerformStart()
        {
            base.PerformStart();

            TreeNodeElement draggedNodeElement = this.Context as TreeNodeElement;

            this.draggedNode = draggedNodeElement.Data;
        }
Example #14
0
        protected virtual void UpdateLines()
        {
            TreeNodeElement nodeElement   = this.NodeElement;
            bool            showLines     = nodeElement.TreeViewElement.ShowLines;
            bool            showRootLines = nodeElement.TreeViewElement.ShowRootLines;

            if (!showLines)
            {
                foreach (RadElement child in this.Children)
                {
                    child.Visibility = ElementVisibility.Hidden;
                }
            }
            else
            {
                foreach (RadElement child in this.Children)
                {
                    child.Visibility = ElementVisibility.Visible;
                }
            }
            if (!showRootLines && nodeElement.IsRootNode)
            {
                foreach (RadElement child in this.Children)
                {
                    child.Visibility = ElementVisibility.Collapsed;
                }
            }
            if (this.Children.Count > 0 && !nodeElement.TreeViewElement.ShowExpandCollapse && (!this.NodeElement.IsRootNode || !showLines))
            {
                this.Children[this.Children.Count - 1].Visibility = ElementVisibility.Collapsed;
            }
            if (!showLines)
            {
                return;
            }
            int         index = this.Children.Count - 1;
            RadTreeNode node  = nodeElement.Data;

            if (showLines && showRootLines && (!nodeElement.TreeViewElement.ShowExpandCollapse && this.NodeElement.IsRootNode))
            {
                RadTreeNode nextNode = node.NextNode;
                this.UpdateLine((TreeNodeLineElement)this.Children[0], node, nextNode, nodeElement);
            }
            else
            {
                if ((nodeElement.TreeViewElement.FullLazyMode || node.Nodes.Count > 0) && (!showLines || this.Children.Count <= 0 || (nodeElement.TreeViewElement.ShowExpandCollapse || this.NodeElement.IsRootNode) || (node.Parent == null || !showRootLines)) && (!showLines || showRootLines || (node.parent == null || nodeElement.TreeViewElement.ShowExpandCollapse) || this.Children.Count <= 0))
                {
                    node = node.Parent;
                }
                for (; node != null && index >= 0; --index)
                {
                    RadTreeNode nextNode = node.NextNode;
                    this.UpdateLine((TreeNodeLineElement)this.Children[index], node, nextNode, nodeElement);
                    node = node.Parent;
                }
            }
        }
        protected override bool IsDropTargetValid(ISupportDrop dropTarget)
        {
            TreeNodeElement treeNodeElement = dropTarget as TreeNodeElement;

            if (treeNodeElement != null)
            {
                return(treeNodeElement.Data != this.draggedNode);
            }
            return(base.IsDropTargetValid(dropTarget));
        }
        protected override void OnLostFocus()
        {
            TreeNodeElement ownerElement = this.OwnerElement as TreeNodeElement;

            if (ownerElement == null || !ownerElement.IsInValidState(true) || (ownerElement.ElementTree.Control.Focused || ownerElement.ElementTree.Control.ContainsFocus) || ownerElement.TreeViewElement.IsPerformingEndEdit)
            {
                return;
            }
            ownerElement.TreeViewElement.EndEdit();
        }
        public virtual void Synchronize()
        {
            TreeNodeElement nodeElement = this.NodeElement;

            if (nodeElement == null || nodeElement.Data == null)
            {
                return;
            }
            this.Text = nodeElement.Data.Text;
        }
 protected override bool CanDragOver(
     DropPosition dropPosition,
     TreeNodeElement targetNodeElement)
 {
     if ((this.Owner as RadDataFilterElement).RootNode == targetNodeElement.Data && dropPosition != DropPosition.AsChildNode)
     {
         return(false);
     }
     return(base.CanDragOver(dropPosition, targetNodeElement));
 }
        protected virtual void PerformDragDrop(
            Point dropLocation,
            TreeNodeElement targetNodeElement,
            List <RadTreeNode> draggedNodes)
        {
            RadTreeNode  data         = targetNodeElement.Data;
            DropPosition dropPosition = this.GetDropPosition(dropLocation, targetNodeElement);

            if (dropPosition == DropPosition.AsChildNode)
            {
                bool isCopyingNodes = this.IsCopyingNodes;
                int  index          = 0;
                while (index < draggedNodes.Count)
                {
                    if (!this.OnDragEnding(dropPosition, draggedNodes[index], data))
                    {
                        draggedNodes.RemoveAt(index);
                    }
                    else
                    {
                        ++index;
                    }
                }
                if (this.owner.bindingProvider.CanDrop || data.treeView != null && data.treeView.bindingProvider.CanDrop)
                {
                    this.owner.bindingProvider.DropNodes(data, draggedNodes);
                    foreach (RadTreeNode draggedNode in draggedNodes)
                    {
                        this.owner.OnDragEnded(new RadTreeViewDragEventArgs(draggedNode, data));
                    }
                }
                else
                {
                    foreach (RadTreeNode draggedNode in draggedNodes)
                    {
                        RadTreeNode radTreeNode = draggedNode;
                        if (isCopyingNodes)
                        {
                            radTreeNode = this.CreateTreeNode(radTreeNode);
                        }
                        else
                        {
                            radTreeNode.Remove();
                        }
                        data.Nodes.Add(radTreeNode);
                        this.owner.OnDragEnded(new RadTreeViewDragEventArgs(radTreeNode, data));
                    }
                }
                data.Expand();
            }
            else
            {
                this.PerformDragDropCore(dropPosition, data, draggedNodes);
            }
        }
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF           sizeF       = base.MeasureOverride(availableSize);
            TreeNodeElement nodeElement = this.NodeElement;

            if (nodeElement != null)
            {
                sizeF.Width = (float)nodeElement.TreeViewElement.TreeIndent;
            }
            return(sizeF);
        }
Example #21
0
        public virtual void Synchronize()
        {
            TreeNodeElement nodeElement = NodeElement;

            if (nodeElement != null)
            {
                this.Expanded = nodeElement.Data.Expanded;
                RadTreeViewElement treeViewElement = nodeElement.TreeViewElement;

                if (treeViewElement.FullLazyMode)
                {
                    this.Visibility = ElementVisibility.Visible;
                }
                else
                {
                    if (!treeViewElement.ShowExpandCollapse || nodeElement.Data.Nodes.Count == 0 ||
                        (nodeElement.Data.Parent == null && !treeViewElement.ShowRootLines))
                    {
                        this.Visibility = ElementVisibility.Collapsed;
                    }
                    else
                    {
                        this.Visibility = ElementVisibility.Visible;
                    }
                }

                this.LinkLineColor   = treeViewElement.LineColor;
                this.LinkOrientation = ExpanderItem.LinkLineOrientation.None;
                this.LinkLineStyle   = (DashStyle)treeViewElement.LineStyle;

                if (treeViewElement.ShowLines)
                {
                    if (nodeElement.Data.PrevNode != null || nodeElement.Data.Parent != null)
                    {
                        this.LinkOrientation |= ExpanderItem.LinkLineOrientation.Top | LinkLineOrientation.Horizontal;
                    }
                    if (nodeElement.Data.NextNode != null)
                    {
                        this.LinkOrientation |= LinkLineOrientation.Bottom | LinkLineOrientation.Horizontal;
                    }
                }

                if (this.TreeViewElement.AllowPlusMinusAnimation)
                {
                    this.Opacity = this.TreeViewElement.ContainsMouse ? 1 : 0;
                }
                else
                {
                    this.Opacity = 1;
                }

                UpdateSignImage();
            }
        }
Example #22
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF           desiredSize = base.MeasureOverride(availableSize);
            TreeNodeElement nodeElement = NodeElement;

            if (nodeElement != null)
            {
                desiredSize.Width = nodeElement.TreeViewElement.TreeIndent;
            }
            return(desiredSize);
        }
        protected override void OnLostFocus()
        {
            TreeNodeElement treeNode = this.OwnerElement as TreeNodeElement;

            if (treeNode != null &&
                treeNode.IsInValidState(true) &&
                !treeNode.ElementTree.Control.Focused &&
                !treeNode.ElementTree.Control.ContainsFocus)
            {
                treeNode.TreeViewElement.EndEdit();
            }
        }
Example #24
0
 private void listControl_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.Button != MouseButtons.Left || !this.listItemClicked)
     {
         return;
     }
     if (!this.dragging && ExprEditorDragDropManager.IsRealDragging(e.Location, this.downPt))
     {
         RadElement      elementAtPoint  = this.treeControl.ElementTree.GetElementAtPoint(e.Location);
         TreeNodeElement treeNodeElement = elementAtPoint as TreeNodeElement;
         if (treeNodeElement == null && elementAtPoint != null)
         {
             treeNodeElement = elementAtPoint.FindDescendant <TreeNodeElement>();
         }
         if (treeNodeElement == null)
         {
             return;
         }
         this.treeControl.SelectedNode = treeNodeElement.Data;
         this.dragging                      = true;
         this.treeControl.Capture           = true;
         this.treeControl.FindForm().Cursor = Cursors.No;
         this.outlineForm                   = TelerikHelper.CreateOutlineForm();
         this.outlineForm.ShowInTaskbar     = false;
         this.outlineForm.ShowIcon          = false;
         this.outlineForm.BackgroundImage   = (Image)treeNodeElement.GetAsBitmap(Brushes.Transparent, 0.0f, new SizeF(1f, 1f));
         this.outlineForm.FormBorderStyle   = FormBorderStyle.None;
         this.outlineForm.Size              = this.outlineForm.BackgroundImage.Size;
         this.outlineForm.MinimumSize       = this.outlineForm.BackgroundImage.Size;
         this.outlineForm.Location          = new Point(Cursor.Position.X + 2, Cursor.Position.Y + 2);
         this.outlineForm.TopMost           = true;
         this.outlineForm.Show();
     }
     else
     {
         if (!this.dragging)
         {
             return;
         }
         Point mousePosition = Control.MousePosition;
         Point client        = this.treeControl.FindForm().PointToClient(mousePosition);
         this.outlineForm.Location = new Point(mousePosition.X + 5, mousePosition.Y + 5);
         if (this.textBox.Bounds.Contains(client))
         {
             this.treeControl.FindForm().Cursor = Cursors.Arrow;
         }
         else
         {
             this.treeControl.FindForm().Cursor = Cursors.No;
         }
     }
 }
        public override void OnValueChanged()
        {
            base.OnValueChanged();

            if (!((BaseDropDownListEditorElement)this.EditorElement).IsPopupOpen)
            {
                TreeNodeElement element = this.OwnerElement as TreeNodeElement;
                if (element != null && element.TreeViewElement != null && element.TreeViewElement.IsEditing)
                {
                    element.TreeViewElement.EndEdit();
                }
            }
        }
        protected DropPosition GetDropPosition(
            Point dropLocation,
            TreeNodeElement targetNodeElement)
        {
            int num = targetNodeElement.Size.Height / 3;
            int y   = dropLocation.Y;

            if (y < num)
            {
                return(DropPosition.BeforeNode);
            }
            return(y >= num && y <= num * 2 ? DropPosition.AsChildNode : DropPosition.AfterNode);
        }
        protected virtual bool CanDragOver(DropPosition dropPosition, TreeNodeElement targetNodeElement)
        {
            RadTreeViewElement targetTreeView = targetNodeElement.TreeViewElement;

            if (!targetNodeElement.Enabled || !targetTreeView.ElementTree.Control.AllowDrop || !this.IsInValidState(targetTreeView))
            {
                return(false);
            }

            RadTreeNode        targetNode = targetNodeElement.Data;
            List <RadTreeNode> nodes      = new List <RadTreeNode>(draggedNode.TreeViewElement.SelectedNodes);

            // If the count is empty, we are in single selection mode
            if (nodes.Count == 0)
            {
                nodes.Add(draggedNode);
            }

            foreach (RadTreeNode selected in nodes)
            {
                if (selected == targetNode)
                {
                    return(false);
                }

                RadTreeNode parent = targetNode.Parent;

                while (parent != null)
                {
                    if (parent == selected)
                    {
                        return(false);
                    }

                    parent = parent.Parent;
                }

                if (dropPosition == DropPosition.AsChildNode && selected.Parent == targetNode)
                {
                    return(false);
                }
            }

            if (dropPosition == DropPosition.AsChildNode)
            {
                targetTreeView.AutoExpand(targetNode);
            }

            targetTreeView.AutoScroll(targetNodeElement);
            return(true);
        }
Example #28
0
        protected override void OnToggleStateChanging(StateChangingEventArgs e)
        {
            base.OnToggleStateChanging(e);

            if (e.Cancel && e.NewValue == Telerik.WinControls.Enumerations.ToggleState.Indeterminate && !this.IsThreeState)
            {
                TreeNodeElement nodeElement = this.NodeElement;

                if (nodeElement != null && nodeElement.TreeViewElement.TriStateMode)
                {
                    e.Cancel = false;
                }
            }
        }
        protected virtual void OnStructureTreeViewMouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left || this.mouseDownPoint.X < 0 || Math.Abs(e.Location.X - this.mouseDownPoint.X) <= SystemInformation.DragSize.Width && Math.Abs(e.Location.Y - this.mouseDownPoint.Y) <= SystemInformation.DragSize.Height)
            {
                return;
            }
            TreeNodeElement elementAtPoint = this.structureTreeView.ElementTree.GetElementAtPoint(e.Location) as TreeNodeElement;

            if (elementAtPoint == null || elementAtPoint.Data == null || !(elementAtPoint.Data.Tag is LayoutControlItemBase))
            {
                return;
            }
            this.layoutControl.DragOverlay.StartDrag((LayoutControlItemBase)elementAtPoint.Data.Tag);
        }
Example #30
0
        public virtual void Synchronize()
        {
            TreeNodeElement nodeElement = NodeElement;

            if (nodeElement == null)
            {
                return;
            }

            if (nodeElement.Data.Parent is RadTreeViewElement.RootTreeNode && !nodeElement.TreeViewElement.ShowRootLines)
            {
                this.Visibility = ElementVisibility.Collapsed;
                return;
            }
            else
            {
                this.Visibility = ElementVisibility.Visible;
            }

            int level = nodeElement.Data.Level;

            if (!nodeElement.TreeViewElement.FullLazyMode)
            {
                if (nodeElement.Data.Nodes.Count == 0)
                {
                    level++;
                }
                else if (!nodeElement.TreeViewElement.ShowExpandCollapse)
                {
                    level++;
                }
            }


            while (this.Children.Count > level)
            {
                this.Children.RemoveAt(this.Children.Count - 1);
            }

            while (this.Children.Count < level)
            {
                this.Children.Add(new TreeNodeLineElement(nodeElement));
            }

            if (this.Children.Count > 0)
            {
                UpdateLines();
            }
        }