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

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