protected virtual void OnPreviewDragDropCore(RadListVisualItem dragedItem, RadListElement targetList, RadListVisualItem targetElement)
        {
            int index = targetList.Items.IndexOf(targetElement.Data);

            Debug.Assert(index != -1);

            RadListElement dragedListView = dragedItem.Data.Owner;

            IList <RadListDataItem> itemsToMove = new List <RadListDataItem>(dragedListView.SelectedItems.Count);

            foreach (RadListDataItem item in dragedListView.SelectedItems)
            {
                itemsToMove.Add(item);
            }

            dragedListView.BeginUpdate();
            foreach (RadListDataItem item in itemsToMove)
            {
                dragedListView.Items.Remove(item);
            }

            dragedListView.EndUpdate();
            targetList.BeginUpdate();
            foreach (RadListDataItem item in itemsToMove)
            {
                targetList.Items.Insert(index++, item);
            }

            targetList.EndUpdate();
        }
Esempio n. 2
0
 protected override void CreateChildItems(RadElement parent)
 {
     base.CreateChildItems(parent);
     this.element = this.CreateListElement();
     parent.Children.Add((RadElement)this.element);
     this.WireEvents();
 }
 protected virtual void OnPreviewDragDropCore(
     RadListElement targetList,
     RadListVisualItem targetElement)
 {
     int num = targetList.Items.Count - 1;
       if (targetElement != null)
     num = targetList.Items.IndexOf(targetElement.Data);
       if (this.draggedItem.Owner != targetList)
     ++num;
       RadListElement owner = this.draggedItem.Owner;
       IList<RadListDataItem> radListDataItemList = (IList<RadListDataItem>) new List<RadListDataItem>(owner.SelectedItems.Count);
       foreach (RadListDataItem selectedItem in (IEnumerable<RadListDataItem>) owner.SelectedItems)
     radListDataItemList.Add(selectedItem);
       owner.BeginUpdate();
       foreach (RadListDataItem radListDataItem in (IEnumerable<RadListDataItem>) radListDataItemList)
       {
     radListDataItem.Selected = radListDataItem.Active = false;
     owner.Items.Remove(radListDataItem);
       }
       owner.EndUpdate();
       targetList.BeginUpdate();
       foreach (RadListDataItem radListDataItem in (IEnumerable<RadListDataItem>) radListDataItemList)
       {
     targetList.Items.Insert(num++, radListDataItem);
     radListDataItem.Selected = radListDataItem.Active = true;
       }
       targetList.EndUpdate();
 }
 private int GetDropHintWidth(RadListElement listElement)
 {
     int num = listElement.ControlBoundingRectangle.Width - LightVisualElement.GetBorderThickness((LightVisualElement) listElement, true).Horizontal;
       if (listElement.VScrollBar.Visibility == ElementVisibility.Visible)
     num -= listElement.VScrollBar.Size.Width;
       return num;
 }
        protected virtual void UpdateHintPosition(Point mousePosition)
        {
            RadListElement    nodeElement = this.DropTarget as RadListElement;
            RadListVisualItem item        = nodeElement.ElementTree.GetElementAtPoint(nodeElement.ElementTree.Control.PointToClient(mousePosition)) as RadListVisualItem;

            if (item == null)
            {
                return;
            }

            Rectangle itemBounds  = nodeElement.ElementTree.Control.RectangleToScreen(item.ControlBoundingRectangle);
            Padding   margins     = Padding.Empty;
            int       imageHeight = 1;

            //if (this.DropHintColor == Color.Empty)
            //{
            //    RadImageShape imageShape = this.owner.ItemDropHint;
            //    imageHeight = imageShape.Image.Size.Height;
            //    margins = imageShape.Margins;
            //}

            Point client      = nodeElement.PointFromScreen(mousePosition);
            bool  isDropAtTop = client.Y <= nodeElement.Size.Height / 2;
            int   y           = isDropAtTop ? itemBounds.Y : itemBounds.Bottom;
            Point hitLocation = new Point(itemBounds.X - margins.Left, y - imageHeight / 2);

            this.dropHintWindow.Width = itemBounds.Width;
            this.dropHintWindow.ShowWindow(hitLocation);
        }
        protected override void HandleMouseMove(Point mousePosition)
        {
            base.HandleMouseMove(mousePosition);
            if (this.DropTarget == null)
            {
                return;
            }

            RadListElement nodeElement = this.DropTarget as RadListElement;

            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);
            }
        }
 public RadListDataItemSelectedCollection(RadListElement owner)
 {
     if (owner == null)
     {
         throw new ArgumentException("This collection can not be created without an owner. The owner argument can not be null.");
     }
     this.owner = owner;
 }
Esempio n. 8
0
 public ListDataLayer(RadListElement owner)
 {
     this.owner      = owner;
     this.listSource = this.CreateListSource();
     this.items      = this.CreateItemsCollection(owner);
     this.listSource.CollectionView.GroupDescriptors.Add("GroupKey", ListSortDirection.Ascending);
     this.WireEvents();
 }
Esempio n. 9
0
 public ListGroupFactory(RadListElement owner)
 {
     this.owner               = owner;
     groups                   = new ListGroupCollection(this);
     this.DefaultGroup        = new ListGroup(0L, owner);
     this.DefaultGroup.Header = "Ungrouped";
     groups.GroupList.Add(this.DefaultGroup);
 }
Esempio n. 10
0
 public ListGroupFactory(RadListElement owner)
 {
     this.owner               = owner;
     this.groups              = new ListGroupCollection(this);
     this.DefaultGroup        = new ListGroup((object)0L, owner);
     this.DefaultGroup.Header = "Ungrouped";
     this.groups.GroupList.Add((Group <RadListDataItem>) this.DefaultGroup);
 }
Esempio n. 11
0
 public ListElementProvider(RadListElement listElement)
 {
     if (listElement == null)
     {
         throw new ArgumentException("Owner element can not be null.");
     }
     this.listElement = listElement;
 }
 public RadCheckedListDataItemCollection(
   RadCheckedDropDownListElement owner,
   ListDataLayer dataLayer,
   RadListElement ownerListElement)
   : base(dataLayer, ownerListElement)
 {
   this.owner = owner;
 }
 internal RadListDataItemCollection(
     ListDataLayer dataLayer,
     RadListElement ownerListElement,
     bool useDataView)
 {
     this.dataLayer        = dataLayer;
     this.ownerListElement = ownerListElement;
     this.useDataView      = useDataView;
 }
 protected override void OnPreviewDragOver(RadDragOverEventArgs e)
 {
     RadListVisualItem hitTarget = e.HitTarget as RadListVisualItem;
       RadListElement radListElement = e.HitTarget as RadListElement;
       if (hitTarget != null)
     radListElement = hitTarget.Data.Owner;
       e.CanDrop = radListElement.AllowDragDrop;
       base.OnPreviewDragOver(e);
 }
Esempio n. 15
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.UnwireEvents();
         this.element = (RadListElement)null;
     }
     base.Dispose(disposing);
 }
        protected override void OnPreviewDragDrop(RadDropEventArgs e)
        {
            RadListVisualItem dragedItem    = e.DragInstance as RadListVisualItem;
            RadListElement    targetList    = e.HitTarget as RadListElement;
            RadListVisualItem targetElement = targetList.ElementTree.GetElementAtPoint(e.DropLocation) as RadListVisualItem;

            this.OnPreviewDragDropCore(dragedItem, targetList, targetElement);

            base.OnPreviewDragDrop(e);
        }
        private int GetDropHintWidth(RadListElement listElement)
        {
            int width = listElement.ControlBoundingRectangle.Width - listElement.GetBorderThickness(true).Horizontal;

            if (listElement.VScrollBar.Visibility == ElementVisibility.Visible)
            {
                width -= listElement.VScrollBar.Size.Width;
            }

            return(width);
        }
 protected virtual bool CanShowDropHint(Point mousePosition)
 {
     RadListElement dropTarget = this.DropTarget as RadListElement;
       if (dropTarget == null)
     return false;
       Point point = dropTarget.PointFromScreen(mousePosition);
       int num = dropTarget.ItemHeight / 3;
       if (point.Y >= num)
     return point.Y > num * 2;
       return true;
 }
        protected virtual bool CanShowDropHint(Point mousePosition)
        {
            RadListElement element = this.DropTarget as RadListElement;

            if (element == null)
            {
                return(false);
            }

            Point client = element.PointFromScreen(mousePosition);
            int   part   = element.ItemHeight / 3;

            return(client.Y < part || client.Y > part * 2);
        }
 protected virtual void UpdateHintPosition(Point mousePosition)
 {
     RadListElement dropTarget = this.DropTarget as RadListElement;
       RadListVisualItem elementAtPoint = dropTarget.ElementTree.GetElementAtPoint(dropTarget.ElementTree.Control.PointToClient(mousePosition)) as RadListVisualItem;
       if (elementAtPoint == null)
     return;
       Rectangle screen = dropTarget.ElementTree.Control.RectangleToScreen(elementAtPoint.ControlBoundingRectangle);
       Padding empty = Padding.Empty;
       int num1 = 1;
       int num2 = dropTarget.PointFromScreen(mousePosition).Y <= dropTarget.Size.Height / 2 ? screen.Y : screen.Bottom;
       Point screenLocation = new Point(screen.X - empty.Left, num2 - num1 / 2);
       this.dropHintWindow.Width = screen.Width;
       this.dropHintWindow.ShowWindow(screenLocation);
 }
 protected override void OnPreviewDragDrop(RadDropEventArgs e)
 {
     base.OnPreviewDragDrop(e);
       if (e.Handled || this.owner.DataSource != null)
     return;
       RadListVisualItem targetElement = e.HitTarget as RadListVisualItem;
       RadListElement targetList = e.HitTarget as RadListElement;
       if (targetElement != null)
     targetList = targetElement.Data.Owner;
       else
     targetElement = targetList.ElementTree.GetElementAtPoint(e.DropLocation) as RadListVisualItem;
       if (this.draggedItem == null || this.draggedItem.DataBoundItem != null || targetList.DataSource != null)
     return;
       this.OnPreviewDragDropCore(targetList, targetElement);
 }
 protected virtual void PrepareDragHint(RadListElement listElement)
 {
     Size size = Size.Empty;
       size = new Size(this.GetDropHintWidth(listElement), 1);
       Bitmap bitmap = new Bitmap(size.Width, size.Height);
       using (Graphics graphics = Graphics.FromImage((Image) bitmap))
       {
     using (SolidBrush solidBrush = new SolidBrush(Color.Red))
       graphics.FillRectangle((Brush) solidBrush, new Rectangle(Point.Empty, size));
       }
       if (bitmap == null)
     return;
       this.dropHintWindow = new RadLayeredWindow();
       this.dropHintWindow.BackgroundImage = (Image) bitmap;
 }
        protected override RectangleF ArrangeElementCore(RadElement element, SizeF finalSize, RectangleF arrangeRect)
        {
            RadListElement    listElement = this.Parent as RadListElement;
            RadListVisualItem item        = element as RadListVisualItem;

            if (listElement != null && listElement.ShowGroups && item != null && !(item is RadListVisualGroupItem) &&
                item.Data.Group != item.Data.Owner.groupFactory.DefaultGroup && item.Data.Group.Collapsible)
            {
                float offset = listElement.CollapsibleGroupItemsOffset;
                arrangeRect = new RectangleF(arrangeRect.Left + offset, arrangeRect.Top, arrangeRect.Width - offset, arrangeRect.Height);
            }

            element.Arrange(arrangeRect);
            return(arrangeRect);
        }
Esempio n. 24
0
        protected override bool BeginMeasure(SizeF availableSize)
        {
            RadListElement parent = this.Parent as RadListElement;

            if (parent != null && parent.AutoSizeItems)
            {
                this.SuspendThemeRefresh();
                bool  flag = false;
                float num  = 0.0f;
                if (this.ElementTree != null)
                {
                    DropDownPopupForm control = this.ElementTree.Control as DropDownPopupForm;
                    if (control != null)
                    {
                        num = control.OwnerDropDownListElement.DesiredSize.Width;
                    }
                }
                foreach (RadListDataItem data in (IEnumerable <RadListDataItem>)parent.Items)
                {
                    if ((double)this._previousAvailableSize.Width != (double)availableSize.Width || data.measureDirty)
                    {
                        float      width      = (double)availableSize.Width == 0.0 ? num : availableSize.Width;
                        RadElement radElement = this.UpdateElement(data is DescriptionTextListDataItem ? 1 : 0, data) as RadElement;
                        if (radElement != null)
                        {
                            radElement.InvalidateMeasure(true);
                            radElement.Measure(parent.FitItemsToSize ? new SizeF(width, float.PositiveInfinity) : LayoutUtils.InfinitySize);
                            flag |= data.MeasuredSize != radElement.DesiredSize;
                            data.MeasuredSize = radElement.DesiredSize;
                        }
                    }
                }
                if (flag)
                {
                    parent.Scroller.UpdateScrollRange();
                }
                this.ResumeThemeRefresh();
            }
            this._previousAvailableSize = availableSize;
            return(base.BeginMeasure(availableSize));
        }
        protected virtual void PrepareDragHint(RadListElement listElement)
        {
            Bitmap image    = null;
            Size   hintSize = Size.Empty;

            hintSize = new Size(this.GetDropHintWidth(listElement), 1);
            image    = new Bitmap(hintSize.Width, hintSize.Height);

            using (Graphics temp = Graphics.FromImage(image))
            {
                using (SolidBrush solidBrush = new SolidBrush(Color.Red))
                {
                    temp.FillRectangle(solidBrush, new Rectangle(Point.Empty, hintSize));
                }
            }


            if (image != null)
            {
                this.dropHintWindow = new RadLayeredWindow();
                this.dropHintWindow.BackgroundImage = image;
            }
        }
Esempio n. 26
0
 protected virtual RadListDataItemCollection CreateItemsCollection(RadListElement owner)
 {
     return(new RadListDataItemCollection(this, owner));
 }
 public RadListDataItemCollection(ListDataLayer dataLayer, RadListElement ownerListElement)
 {
     this.dataLayer        = dataLayer;
     this.ownerListElement = ownerListElement;
 }
 public CheckedDropDownListElementProvider(RadListElement listElement)
     : base(listElement)
 {
 }
 public ColorListBoxElementProvider(RadListElement listElement)
     : base(listElement)
 {
 }
 public ListControlDragDropService(RadListElement owner)
 {
     this.owner = owner;
 }