Hey guys,
I know there is a built in ability to click on the tab within a pane and move it out creating a new Floating Panel. The problem is that we have a custom browser and when deployed into that browser this feature does not work. I know you can still double click to undock the pane, but that is unsatifactory for the application.
I need to know how to get the control that is attached to each tab so that I can force it to undock when the user drags it out. I am currently using the below code to get into the element, but beyond that I am completely lost.
Any and all help is appreciated, as always.
private void uDockManager_MouseEnterElement(object sender, UIElementEventArgs e) { if (e.Element is TabItemUIElement) e.Element.Control.MouseDown += new MouseEventHandler(OnControlMouseDown); }
Hello,
I`m not sure that I understand your scenario, but maybe you could take the desired control from ControlPanes collection. For example:
ultraDockManager1.ControlPanes[0].Control;
Please let me know if you have any questions
Regards
Hi,
Have you been able to resolve your issue ? Let me know if you have any questions.
Georgi,
I apologize, I didn't get an email regarding your first post. However, I was able to get the control that was hosted in each pane using the MouseEnterElement of the UltraDockManager.
private void uDockManager_MouseEnterElement(object sender, UIElementEventArgs e) { if (e.Element is TabItemUIElement) { var tabElement = (TabItemUIElement)e.Element; var tabItem = tabElement.TabItem; _key = (from value in ControlsDictionary.ParentControls where value.Value == tabItem.Text select value.Key).Single(); e.Element.Control.MouseDown += new MouseEventHandler(Control_MouseDown); e.Element.Control.MouseUp += new MouseEventHandler(Control_MouseUp); } }
private void Control_MouseDown(object sender, MouseEventArgs e) { _mouseIsDown = true; foreach (var pane in uDockManager.ControlPanes) { if (pane.Key == _key) { _dragPane = new DockableControlPane(); _dragPane = pane; } } }
private void Control_MouseUp(object sender, MouseEventArgs e) { _mouseIsDown = false; }
private void uDockManager_MouseLeaveElement(object sender, UIElementEventArgs e) { if (_dragPane == null) _mouseIsDown = false; if (e.Element is TabGroupUIElement) { if (_dragPane != null && _dragPaneDockingArea != null && _mouseIsDown && _dragPane.DockedState != DockedState.Floating) { Point location = new Point(Cursor.Position.X - 150, Cursor.Position.Y - 22); _dragPane.Float(false, location); MouseAPI.MouseClickLeftUp(); Cursor.Position = location + new Size(150, 11); MouseAPI.MouseClickLeftDown(); _dragPane = null; _dragPaneDockingArea = null; } } e.Element.Control.MouseDown -= new MouseEventHandler(Control_MouseDown); e.Element.Control.MouseUp -= new MouseEventHandler(Control_MouseUp); }
I don't know if it is the best way to do what needed to be done, but it works. Thanks!
Thanks for your response. Let me know if you have any further questions.