public DragablzDragCompletedEventArgs(DragablzItem dragablzItem, DragCompletedEventArgs dragCompletedEventArgs)
        {
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException("dragCompletedEventArgs");
            }

            _dragablzItem           = dragablzItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }
Esempio n. 2
0
        private LocationInfo GetLocationInfo(DragablzItem item)
        {
            var    size = _getDesiredSize(item);
            double startLocation;

            if (!_activeStoryboardTargetLocations.TryGetValue(item, out startLocation))
            {
                startLocation = _getLocation(item);
            }
            var midLocation = startLocation + size / 2;
            var endLocation = startLocation + size;

            return(new LocationInfo(item, startLocation, midLocation, endLocation));
        }
        public DragablzDragCompletedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragCompletedEventArgs dragCompletedEventArgs)
            : base(routedEvent, source)
        {
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException("dragCompletedEventArgs");
            }

            _dragablzItem           = dragablzItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }
Esempio n. 4
0
        public ItemActionCallbackArgs(Window window, TOwner owner, DragablzItem dragablzItem)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }

            _window       = window;
            _owner        = owner;
            _dragablzItem = dragablzItem;
        }
Esempio n. 5
0
        private void SendToLocation(DragablzItem dragablzItem, double location)
        {
            double activeTarget;

            if (Math.Abs(_getLocation(dragablzItem) - location) < 1.0
                ||
                _activeStoryboardTargetLocations.TryGetValue(dragablzItem, out activeTarget) &&
                Math.Abs(activeTarget - location) < 1.0)
            {
                return;
            }

            _activeStoryboardTargetLocations[dragablzItem] = location;

            var storyboard = new Storyboard {
                FillBehavior = FillBehavior.Stop
            };

            storyboard.WhenComplete(sb =>
            {
                _setLocation(dragablzItem, location);
                sb.Remove(dragablzItem);
                _activeStoryboardTargetLocations.Remove(dragablzItem);
            });

            var timeline = new DoubleAnimationUsingKeyFrames();

            timeline.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(_canvasDependencyProperty));
            timeline.KeyFrames.Add(
                new EasingDoubleKeyFrame(location, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200)))
            {
                EasingFunction = new CubicEase()
                {
                    EasingMode = EasingMode.EaseOut
                }
            });
            storyboard.Children.Add(timeline);
            storyboard.Begin(dragablzItem, true);
        }
Esempio n. 6
0
 private void SetLocation(DragablzItem dragablzItem, double location)
 {
     _setLocation(dragablzItem, location);
 }
Esempio n. 7
0
        public virtual void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds,
                                                    IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException("siblingItems");
            }
            var currentLocations = siblingItems
                                   .Select(GetLocationInfo)
                                   .Union(new[] { GetLocationInfo(dragItem) })
                                   .OrderBy(loc => loc.Item == dragItem ? loc.Start : _siblingItemLocationOnDragStart[loc.Item].Start);

            var currentCoord = 0.0;
            var z            = int.MaxValue;
            var logicalIndex = 0;

            foreach (var location in currentLocations)
            {
                SetLocation(location.Item, currentCoord);
                currentCoord += _getDesiredSize(location.Item) + _itemOffset;
                Panel.SetZIndex(location.Item, --z);
                location.Item.LogicalIndex = logicalIndex++;
            }
            Panel.SetZIndex(dragItem, int.MaxValue);
        }
Esempio n. 8
0
        public virtual void OrganiseOnDragStarted(DragablzItemsControl requestor, Size measureBounds,
                                                  IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException("siblingItems");
            }
            if (dragItem == null)
            {
                throw new ArgumentNullException("dragItem");
            }

            _siblingItemLocationOnDragStart = siblingItems.Select(GetLocationInfo).ToDictionary(loc => loc.Item);
        }
Esempio n. 9
0
 public virtual void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Size measureBounds,
                                               List <DragablzItem> siblingItems, DragablzItem dragablzItem)
 {
 }
Esempio n. 10
0
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, source, dragablzItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Esempio n. 11
0
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, dragablzItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Esempio n. 12
0
 public DragablzItemEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem)
     : base(routedEvent, source)
 {
     _dragablzItem = dragablzItem;
 }
Esempio n. 13
0
 public DragablzItemEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem)
     : base(routedEvent)
 {
     _dragablzItem = dragablzItem;
 }
Esempio n. 14
0
 public virtual void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds, IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
 {
 }
Esempio n. 15
0
        public virtual void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Size measureBounds, List <DragablzItem> siblingItems, DragablzItem dragablzItem)
        {
            var zIndex = int.MaxValue;

            foreach (var source in siblingItems.OrderByDescending(Panel.GetZIndex))
            {
                Panel.SetZIndex(source, --zIndex);
            }
            Panel.SetZIndex(dragablzItem, int.MaxValue);
        }