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

            _dragablzItem           = dragablzItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }
Exemplo 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;
        }
Exemplo 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;
        }
Exemplo 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);
        }
Exemplo n.º 6
0
 private void SetLocation(DragablzItem dragablzItem, double location)
 {
     _setLocation(dragablzItem, location);
 }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 9
0
 public virtual void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Size measureBounds,
                                               List <DragablzItem> siblingItems, DragablzItem dragablzItem)
 {
 }
Exemplo n.º 10
0
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, source, dragablzItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Exemplo n.º 11
0
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, dragablzItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Exemplo n.º 12
0
 public DragablzItemEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem)
     : base(routedEvent, source)
 {
     _dragablzItem = dragablzItem;
 }
Exemplo n.º 13
0
 public DragablzItemEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem)
     : base(routedEvent)
 {
     _dragablzItem = dragablzItem;
 }
Exemplo n.º 14
0
 public virtual void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds, IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
 {
 }
Exemplo 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);
        }