private void Item_MoveIn(SeparablePanelItem sender, int index = 0)
 {
     if (Children.Contains(indicator))
     {
         DockPanel.SetDock(sender, indicator.InsertMode);
         Children.Insert(Children.IndexOf(indicator), sender);
         Children.Remove(indicator);
     }
     else
     {
         Children.Insert(index, sender);
     }
 }
        private bool Item_Move(SeparablePanelItem sender, bool is_enter)
        {
            if (Children.Contains(indicator))
            {
                Point p = Mouse.GetPosition(indicator);
                if (indicator.InsertMode == Dock.Left && (p.X < 0 || range <= p.X))
                {
                    Children.Remove(indicator);
                }
                else if (indicator.InsertMode == Dock.Right && (p.X < indicator.ActualWidth - range || indicator.ActualWidth <= p.X))
                {
                    Children.Remove(indicator);
                }
                else if (indicator.InsertMode == Dock.Top && (p.Y < 0 || range <= p.Y))
                {
                    Children.Remove(indicator);
                }
                else if (indicator.InsertMode == Dock.Bottom && (p.Y < indicator.ActualHeight - range || indicator.ActualHeight <= p.Y))
                {
                    Children.Remove(indicator);
                }
                else
                {
                    return(true);
                }
            }
            if (!is_enter)
            {
                return(false);
            }
            #region 判断鼠标在哪个子面板中
            for (int i = 0; i < Children.Count; ++i)
            {
                FrameworkElement item = Children[i] as FrameworkElement;
                if (item.Visibility != Visibility.Visible)
                {
                    continue;
                }
                bool isLast = i == Children.Count - 1;
                if (sender.Orientation == Orientation.Vertical)
                {
                    Dock  dock = DockPanel.GetDock(item);
                    Point p    = Mouse.GetPosition(item);
                    if (p.Y < 0 || item.ActualHeight <= p.Y)
                    {
                        continue;
                    }
                    indicator.Width  = sender.ActualWidth;
                    indicator.Height = double.NaN;
                    if (0 <= p.X && p.X < range)
                    {
                        if (dock == Dock.Right)
                        {
                            indicator.InsertMode = isLast ? Dock.Left : Dock.Right;
                            Children.Insert(Children.IndexOf(item) + (isLast ? 0 : 1), indicator);
                        }
                        else
                        {
                            indicator.InsertMode = Dock.Left;
                            Children.Insert(Children.IndexOf(item), indicator);
                        }
                        return(true);
                    }
                    else if (item.ActualWidth - range <= p.X && p.X < item.ActualWidth)
                    {
                        if (dock == Dock.Left)
                        {
                            indicator.InsertMode = isLast ? Dock.Right : Dock.Left;
                            Children.Insert(Children.IndexOf(item) + (isLast ? 0 : 1), indicator);
                        }
                        else
                        {
                            indicator.InsertMode = Dock.Right;
                            Children.Insert(Children.IndexOf(item), indicator);
                        }
                        return(true);
                    }
                }
                else if (sender.Orientation == Orientation.Horizontal)
                {
                    Dock  dock = DockPanel.GetDock(item);
                    Point p    = Mouse.GetPosition(item);
                    if (p.X < 0 || item.ActualWidth <= p.X)
                    {
                        continue;
                    }
                    indicator.Height = sender.ActualHeight;
                    indicator.Width  = double.NaN;
                    if (0 <= p.Y && p.Y < range)
                    {
                        if (dock == Dock.Bottom)
                        {
                            indicator.InsertMode = isLast ? Dock.Top : Dock.Bottom;
                            Children.Insert(Children.IndexOf(item) + (isLast ? 0 : 1), indicator);
                        }
                        else
                        {
                            indicator.InsertMode = Dock.Top;
                            Children.Insert(Children.IndexOf(item), indicator);
                        }
                        return(true);
                    }
                    else if (item.ActualHeight - range <= p.Y && p.Y < item.ActualHeight)
                    {
                        if (dock == Dock.Top)
                        {
                            indicator.InsertMode = isLast ? Dock.Bottom : Dock.Top;
                            Children.Insert(Children.IndexOf(item) + (isLast ? 0 : 1), indicator);
                        }
                        else
                        {
                            indicator.InsertMode = Dock.Bottom;
                            Children.Insert(Children.IndexOf(item), indicator);
                        }
                        return(true);
                    }
                }
            }
            return(false);

            #endregion
        }
 private void Item_MoveOut(SeparablePanelItem sender)
 {
     Children.Remove(sender);
 }