Example #1
0
        private void SendToLocation(DockItem dockItem, double location)
        {
            double activeTarget;

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

            _activeAnimationTargetLocations[dockItem] = location;

            var animation = Animate.Property(dockItem, _canvasPerspexProperty, dockItem.GetValue(_canvasPerspexProperty),
                                             location, LinearEasing.For <double>(), TimeSpan.FromMilliseconds(200));

            animation.Subscribe(_ => { }, () =>
            {
                _setLocation(dockItem, location);
                _activeAnimationTargetLocations.Remove(dockItem);
            });
        }
Example #2
0
 public DockDragStartedEventArgs(RoutedEvent routedEvent, IInteractive source, DockItem dockItem,
                                 VectorEventArgs dragStartedEventArgs)
     : base(routedEvent, source, dockItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Example #3
0
 public DockDragStartedEventArgs(RoutedEvent routedEvent, DockItem dockItem, VectorEventArgs dragStartedEventArgs)
     : base(routedEvent, dockItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
Example #4
0
 public void OrganizeOnDragCompleted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem)
 {
 }
Example #5
0
        public void OrganizeOnMouseDownWithin(DockItemsControl requestor, Size measureBounds, List <DockItem> siblingItems, DockItem dockItem)
        {
            var zIndex = int.MaxValue;

            foreach (var source in siblingItems.OrderByDescending(x => x.GetValue(Visual.ZIndexProperty)))
            {
                source.SetValue(Visual.ZIndexProperty, --zIndex);
            }
            dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue);
        }
 private Action <RoutedEventArgs> OnMouseDownWithin(DockItem dockItem)
 {
     return(args => dockItem.RaiseEvent(new DockItemEventArgs(MouseDownWithinEvent, dockItem)));
 }
 public DockItemEventArgs(RoutedEvent routedEvent, IInteractive source, DockItem dockItem)
     : base(routedEvent, source)
 {
     _dockItem = dockItem;
 }
 public DockItemEventArgs(RoutedEvent routedEvent, DockItem dockItem)
     : base(routedEvent)
 {
     _dockItem = dockItem;
 }
Example #9
0
 private void SetLocation(DockItem dockItem, double location)
 {
     _setLocation(dockItem, location);
 }
Example #10
0
        public void OrganizeOnDragCompleted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException(nameof(siblingItems));
            }
            var currentLocations = siblingItems
                                   .Select(GetLocationInfo)
                                   .Union(new[] { GetLocationInfo(dockItem) })
                                   .OrderBy(loc => loc.Item == dockItem ? 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;
                location.Item.SetValue(Visual.ZIndexProperty, --z);
                location.Item.LogicalIndex = logicalIndex++;
            }
            dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue);
        }
Example #11
0
        public void OrganizeOnDragStarted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException(nameof(siblingItems));
            }
            if (dockItem == null)
            {
                throw new ArgumentNullException(nameof(dockItem));
            }

            _siblingItemLocationOnDragStart = siblingItems.Select(GetLocationInfo).ToDictionary(loc => loc.Item);
        }
Example #12
0
 public void OrganizeOnMouseDownWithin(DockItemsControl requestor, Size measureBounds, List <DockItem> siblingItems, DockItem dockItem)
 {
 }
Example #13
0
 private bool IsMyItem(DockItem item)
 {
     return(_dockItemsControl != null && _dockItemsControl.DockItems().Contains(item));
 }
        public DockDragCompletedEventArgs(RoutedEvent routedEvent, IInteractive source, DockItem dockItem,
                                          VectorEventArgs dragCompletedEventArgs)
            : base(routedEvent, source)
        {
            if (dockItem == null)
            {
                throw new ArgumentNullException(nameof(dockItem));
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException(nameof(dragCompletedEventArgs));
            }

            _dockItem = dockItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }