/// <summary> /// Function called when dragged window enters already docked window</summary> /// <param name="sender">Dockable window being dragged</param> /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param> public void DockDragEnter(object sender, DockDragDropEventArgs e) { Point center = new Point(ActualWidth / 2, ActualHeight / 2); int space = (int)Root.DockIconSize.Width / 4; ResourceDictionary rd = new ResourceDictionary(); rd.Source = new Uri("/Atf.Gui.Wpf;component/Resources/DockIcons.xaml", UriKind.Relative); if (m_dockLeftIcon == null) { m_dockLeftIcon = new DockIcon((Style)rd["DockLeftIcon"], Root.DockIconSize); m_dockRightIcon = new DockIcon((Style)rd["DockRightIcon"], Root.DockIconSize); m_dockTopIcon = new DockIcon((Style)rd["DockTopIcon"], Root.DockIconSize); m_dockBottomIcon = new DockIcon((Style)rd["DockBottomIcon"], Root.DockIconSize); m_dockTabIcon = new DockIcon((Style)rd["DockTabIcon"], Root.DockIconSize); } Window owner = Window.GetWindow(this); Point offset = ((UIElement)Root).PointFromScreen(PointToScreen(new Point(0, 0))); m_dockLeftIcon.Offset = new Point(offset.X + center.X - Root.DockIconSize.Width / 2 - Root.DockIconSize.Width - space, offset.Y + center.Y - Root.DockIconSize.Height / 2); m_dockRightIcon.Offset = new Point(offset.X + center.X + Root.DockIconSize.Width / 2 + space, offset.Y + center.Y - Root.DockIconSize.Height / 2); m_dockTopIcon.Offset = new Point(offset.X + center.X - Root.DockIconSize.Width / 2, offset.Y + center.Y - Root.DockIconSize.Height / 2 - Root.DockIconSize.Height - space); m_dockBottomIcon.Offset = new Point(offset.X + center.X - Root.DockIconSize.Width / 2, offset.Y + center.Y + Root.DockIconSize.Height / 2 + space); m_dockTabIcon.Offset = new Point(offset.X + center.X - Root.DockIconSize.Width / 2, offset.Y + center.Y - Root.DockIconSize.Height / 2); DockIconsLayer dockIconLayer = Root.DockIconsLayer; dockIconLayer.AddChild(m_dockLeftIcon); dockIconLayer.AddChild(m_dockRightIcon); dockIconLayer.AddChild(m_dockTopIcon); dockIconLayer.AddChild(m_dockBottomIcon); dockIconLayer.AddChild(m_dockTabIcon); }
/// <summary> /// Function called when dragged window enters already docked window</summary> /// <param name="sender">Dockable window being dragged</param> /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param> public void DockDragEnter(object sender, DockDragDropEventArgs e) { Point center = new Point(ActualWidth / 2, ActualHeight / 2); ResourceDictionary rd = new ResourceDictionary(); rd.Source = new Uri("/Atf.Gui.Wpf;component/Resources/DockIcons.xaml", UriKind.Relative); if (m_dockTabIcon == null) { m_dockTabIcon = new DockIcon((Style)rd["DockTabIcon"], Root.DockIconSize); } m_dockTabIcon.Offset = new Point(center.X - Root.DockIconSize.Width / 2, center.Y - Root.DockIconSize.Height / 2); m_dockTabIcon.Highlight = false; DockIconsLayer.AddChild(m_dockTabIcon); }