/// <summary>
        /// Applies a horizontal offset to the dragged <see cref="DockTabItem"/>s.
        /// </summary>
        private void SetTranslateTransform()
        {
            Debug.Assert(_targetDockTabPane != null);

            double?offset = null;

            for (int i = 0; i < _targetDockTabPane.Items.Count; i++)
            {
                var dockTabItem = _targetDockTabPane.ItemContainerGenerator.ContainerFromIndex(i) as DockTabItem;

                if (dockTabItem == null)
                {
                    continue;   // Item container not yet generated.
                }
                if (!_draggedItems.Contains(dockTabItem.GetViewModel()))
                {
                    continue;   // Item is not dragged.
                }
                if (offset == null)
                {
                    // The mouse cursor should be on the first dragged DockTabItem.
                    if (_mouseOffset.X < 0 || _mouseOffset.X > dockTabItem.RenderSize.Width)
                    {
                        if (dockTabItem.RenderSize.Width > 0)
                        {
                            _mouseOffset.X = dockTabItem.RenderSize.Width / 4;
                        }
                        else
                        {
                            _mouseOffset.X = 32;    // Item not yet measured. Use default value.
                        }
                    }

                    Point mousePosition = WindowsHelper.GetMousePosition(dockTabItem);
                    offset = mousePosition.X - _mouseOffset.X;
                }

                // Set DockTabPanel.IsDragged flag. Items which are dragged are not animated
                // by the DockTabPanel.
                DockTabPanel.SetIsDragged(dockTabItem, true);

                // Apply offset as RenderTransform.
                var translateTransform = dockTabItem.RenderTransform as TranslateTransform;
                if (translateTransform == null)
                {
                    translateTransform          = new TranslateTransform();
                    dockTabItem.RenderTransform = translateTransform;
                }

                translateTransform.X += offset.Value;
            }
        }
        /// <summary>
        /// Clears the horizontal offset from the dragged <see cref="DockTabItem"/>s.
        /// </summary>
        private void ClearTranslateTransform()
        {
            Debug.Assert(_targetDockTabPane != null);

            for (int i = 0; i < _targetDockTabPane.Items.Count; i++)
            {
                var dockTabItem = _targetDockTabPane.ItemContainerGenerator.ContainerFromIndex(i) as DockTabItem;
                if (dockTabItem != null && DockTabPanel.GetIsDragged(dockTabItem))
                {
                    DockTabPanel.SetIsDragged(dockTabItem, false);
                    var translateTransform = dockTabItem.RenderTransform as TranslateTransform;
                    if (translateTransform != null)
                    {
                        translateTransform.X = 0;
                    }
                }
            }
        }