Beispiel #1
0
        public void OrganizeOnDrag(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));
            }

            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 zIndex       = int.MaxValue;

            foreach (var location in currentLocations)
            {
                if (!Equals(location.Item, dockItem))
                {
                    SendToLocation(location.Item, currentCoord);
                    location.Item.SetValue(Visual.ZIndexProperty, --zIndex);
                }
                currentCoord += _getDesiredSize(location.Item) + _itemOffset;
            }
            dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue);
        }
Beispiel #2
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);
        }