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();
        }
 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();
 }
        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 PerformStart()
 {
     base.PerformStart();
       RadListVisualItem context = this.Context as RadListVisualItem;
       if (context == null)
     return;
       this.draggedItem = context.Data;
 }
 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);
 }
        public override AccessibleObject HitTest(int x, int y)
        {
            RadListVisualItem elementAtPoint = this.DropDown.ElementTree.GetElementAtPoint(this.DropDown.PointToClient(new Point(x, y))) as RadListVisualItem;

            if (elementAtPoint != null)
            {
                return(this.GetItemAccessibleObject(elementAtPoint.Data));
            }
            return(base.HitTest(x, y));
        }
        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);
        }
예제 #8
0
        static RadListVisualItem()
        {
            ElementPropertyOptions options = ElementPropertyOptions.AffectsMeasure | ElementPropertyOptions.AffectsDisplay;

            System.Type forType = typeof(RadListVisualItem);
            LightVisualElement.TextImageRelationProperty.OverrideMetadata(forType, (RadPropertyMetadata) new RadElementPropertyMetadata((object)TextImageRelation.ImageBeforeText, options));
            LightVisualElement.ImageAlignmentProperty.OverrideMetadata(forType, (RadPropertyMetadata) new RadElementPropertyMetadata((object)ContentAlignment.MiddleLeft, options));
            LightVisualElement.TextAlignmentProperty.OverrideMetadata(forType, (RadPropertyMetadata) new RadElementPropertyMetadata((object)ContentAlignment.MiddleLeft, options));
            ItemStateManagerFactoryRegistry.AddStateManagerFactory((ItemStateManagerFactoryBase) new RadListVisualItemStateManager(), typeof(RadListVisualItem));
            RadListVisualItem.InitializeSynchronizationProperties();
        }
예제 #9
0
 public RadListVisualItem GetVisualItemAtPoint(Point location)
 {
     for (RadElement radElement = this.ElementTree.GetElementAtPoint(location); radElement != null; radElement = radElement.Parent)
     {
         RadListVisualItem radListVisualItem = radElement as RadListVisualItem;
         if (radListVisualItem != null)
         {
             return(radListVisualItem);
         }
     }
     return((RadListVisualItem)null);
 }
예제 #10
0
        static RadListVisualItem()
        {
            ElementPropertyOptions flags = ElementPropertyOptions.AffectsMeasure | ElementPropertyOptions.AffectsDisplay;
            Type dataItemType            = typeof(RadListVisualItem);

            LightVisualElement.TextImageRelationProperty.OverrideMetadata(dataItemType, new RadElementPropertyMetadata(TextImageRelation.ImageBeforeText, flags));
            LightVisualElement.ImageAlignmentProperty.OverrideMetadata(dataItemType, new RadElementPropertyMetadata(ContentAlignment.MiddleLeft, flags));
            LightVisualElement.TextAlignmentProperty.OverrideMetadata(dataItemType, new RadElementPropertyMetadata(ContentAlignment.MiddleLeft, flags));

            ItemStateManagerFactoryRegistry.AddStateManagerFactory(new RadListVisualItemStateManager(), typeof(RadListVisualItem));
            RadListVisualItem.InitializeSynchronizationProperties();
        }
        public override AccessibleObject HitTest(int x, int y)
        {
            Point             point      = this.DropDown.PointToClient(new Point(x, y));
            RadListVisualItem visualItem = this.DropDown.ElementTree.GetElementAtPoint(point) as RadListVisualItem;

            if (visualItem != null)
            {
                return(new RadListDataItemAccessibleObject(visualItem.Data));
            }

            return(base.HitTest(x, y));
        }
        public override AccessibleObject HitTest(int x, int y)
        {
            Point             location   = this.List.PointToClient(new Point(x, y));
            RadListVisualItem visualItem = this.List.ElementTree.GetElementAtPoint(location) as RadListVisualItem;

            if (visualItem != null)
            {
                return(new RadListDataItemAccessibleObject(visualItem.Data));
            }

            return(null);
        }
 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 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);
        }
예제 #16
0
        public override AccessibleObject HitTest(int x, int y)
        {
            Point             client          = this.List.PointToClient(new Point(x, y));
            RadListVisualItem elementAtPoint1 = this.List.ElementTree.GetElementAtPoint(client) as RadListVisualItem;

            if (elementAtPoint1 != null)
            {
                return((AccessibleObject)this.GetItemAccessibleObject(elementAtPoint1.Data));
            }
            RadScrollBarElement elementAtPoint2 = this.List.ElementTree.GetElementAtPoint(client) as RadScrollBarElement;

            if (elementAtPoint2 != null)
            {
                return((AccessibleObject) new RadScrollBarElementAccessibleObject(elementAtPoint2));
            }
            return((AccessibleObject)null);
        }