To reproduce: - Add RadDock with couple of tool windows to a blank form - Subscribe to the ActiveWindowChanged event. - Run the application and close all windows in the dock. - You will notice that the despite that the ActiveWindow property is set to null the event is not fired.
DECLINED: the issue is in the client's code. To reproduce: - add a dock with some windows - save the layout with this code: var stringWriter = new StringWriter(); radDock1.SaveToXml(stringWriter); savedLayoutString = stringWriter.ToString(); //with this line you can save the same stream to a file and observe that it is saved with UTF-16 - load the layout with the following code: using (var stream = new MemoryStream()) { var streamWriter = new StreamWriter(stream); streamWriter.Write(savedLayoutString); streamWriter.Flush(); stream.Position = 0; radDock1.LoadFromXml(stream); } Workaround - when reading the xml, replace utf-16 with utf-8 streamWriter.Write(File.ReadAllText("qqq.xml").Replace("utf-16", "utf-8"));
To reproduce: Add a ToolWindow to RadDock. AutoHide it: toolWindow1.AutoHide(); Then Hide it: toolWindow1.Hide(); And show it: toolWindow1.Show(); You will see that the window is docked but is not AutoHide Workaround: Call the AutoHide method instead of the Show method: toolWindow1.AutoHide();
To reproduce: - Dock a tool window in a black RadDock. - Drag and drop the toolwindow in the top, bottom, right or left docking guides in the center. - The tool window is docked as document window and fills the entire space. Workaround: public Form1() { InitializeComponent(); DragDropService service = this.radDock1.GetService<DragDropService>(); service.PreviewHitTest += service_PreviewHitTest; radDock1.DockStateChanged += radDock1_DockStateChanged; } void radDock1_DockStateChanged(object sender, DockWindowEventArgs e) { if (dropTarget is DocumentContainer) { if (position != null && position != "Fill") { e.DockWindow.DockState = DockState.Docked; switch (position) { case "Top": radDock1.DockWindow(e.DockWindow, DockPosition.Top); break; case "Left": radDock1.DockWindow(e.DockWindow, DockPosition.Left); break; case "Right": radDock1.DockWindow(e.DockWindow, DockPosition.Right); break; case "Bottom": radDock1.DockWindow(e.DockWindow, DockPosition.Bottom); break; } position = null; } } } string position = null; object dropTarget = null; void service_PreviewHitTest(object sender, DragDropHitTestEventArgs e) { if (e.HitTest.GuidePosition != null) { dropTarget = e.DropTarget; position = e.HitTest.DockPosition.Value.ToString(); Console.WriteLine(e.DropTarget); } }
To reproduce: Create MDI form using RadDock by following the article: http://www.telerik.com/help/winforms/dock-mdi-mode-automatic-mdi-form-handling.html You will notice that the Closing and Closed events of the MdiForms will not be invoked. Workaround: Subscribe to the FormClosing event of the main Form and close all the windows manually: void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.RadDock.CloseAllWindows(); }
To reproduce: Add a few document windows to a RadDock. Start the application and start dragging a document window's tab, do not move the mouse much, you want to keep the red cursor. While at it press escape. The drag operation will be canceled. Now move your mouse over the tabs and you will notice that they will be dragged. Workaround: When the Drag service stops we need to reset some fields. public Form1() { InitializeComponent(); foreach (Control child in ControlHelper.EnumChildControls(this.radDock1, true)) { DocumentTabStrip docStrip = child as DocumentTabStrip; if (docStrip != null) { RadPageViewElement pageViewElement = docStrip.TabStripElement; pageViewElement.ItemDragService.Stopping += ItemDragService_Stopping; pageViewElement.ItemDragService.Started += ItemDragService_Started; break; } } } void ItemDragService_Started(object sender, EventArgs e) { foreach (DockTabStrip strip in DockHelper.GetDockTabStrips<DockTabStrip>(this, true, this.radDock1)) { strip.MouseDown += strip_MouseDown; strip.MouseUp += strip_MouseUp; strip.MouseCaptureChanged += strip_MouseCaptureChanged; strip.MouseMove += strip_MouseMove; } } void ItemDragService_Stopping(object sender, RadServiceStoppingEventArgs e) { foreach (DockTabStrip strip in DockHelper.GetDockTabStrips<DockTabStrip>(this, true, this.radDock1)) { strip.MouseDown -= strip_MouseDown; strip.MouseUp -= strip_MouseUp; strip.MouseCaptureChanged -= strip_MouseCaptureChanged; strip.MouseMove -= strip_MouseMove; strip.GetType().GetMethod("OnMouseCaptureChanged", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(strip, new object[] { EventArgs.Empty }); typeof(TabStripPanel).GetField("dragStart", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(strip, Point.Empty); } } void strip_MouseMove(object sender, MouseEventArgs e) { if (this.isMouseDown.ContainsKey(sender) && !this.isMouseDown[sender]) { sender.GetType().BaseType.BaseType.GetField("dragging", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(sender, true); } } Dictionary<object, bool> isMouseDown = new Dictionary<object, bool>(); void strip_MouseCaptureChanged(object sender, EventArgs e) { this.isMouseDown[sender] = false; } void strip_MouseUp(object sender, MouseEventArgs e) { this.isMouseDown[sender] = false; } void strip_MouseDown(object sender, MouseEventArgs e) { this.isMouseDown[sender] = true; }
Workaround: void radDock1_DockWindowAdded(object sender, DockWindowEventArgs e) { DocumentWindow docWin = e.DockWindow as DocumentWindow; if (docWin != null && docWin.Text.Contains(Environment.NewLine)) { docWin.TabStripItem.Padding = new Padding(25, 2, 3, 2); } }
To reproduce: Add a RadDock to a form and a ToolWindow and set the ToolCaptionButtons to None. Now start the application and you will see that until you focus the ToolWindow, the buttons will be visible. Workaround: Set the ToolCaptionButtons property when the form loads: void CadHandler_Load(object sender, EventArgs e) { foreach (DockWindow window in this.radDock1.DockWindows) { window.ToolCaptionButtons = ToolStripCaptionButtons.None; } }
To reproduce: Add a RadDock with ToolWindow, AutoHide the window and open it. You will see that the splitter is big (12px width) and has a black border on the top left corner Workaround: Subscribe to the DockStateChanged event to hide the problematic element: void dock_DockStateChanged(object sender, DockWindowEventArgs e) { if (e.DockWindow.DockState == DockState.AutoHide) { ((e.DockWindow as ToolWindow).TabStripItem.TabPanel.Parent as AutoHideTabStrip).SplitPanelElement.Children[2].Children[0].Visibility = ElementVisibility.Collapsed; } }
To reproduce: - Add RadDock with some document windows to a blank form. - Make one widow floating and then remove the dock from the current form Controls collection on a button click.
To reproduce: Add a RadDock to a form and every few seconds remove it and add a new one. You will see that the memory will increase. Apparently RadDock has subscribed to the Resize event of the parent form but does not unsubscribe when disposed. Workaround: Unsubscribe from the Resize event of the form prior disposing RadDock: var ctrl = this.Controls["editor"]; var eventInfo = this.GetType().GetEvent("Resize"); var handlerMethod = typeof(RadDock).GetMethod("parentForm_Resize", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var eventDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, ctrl.Controls["radDock1"], handlerMethod); eventInfo.RemoveEventHandler(this, eventDelegate); this.Controls.Remove(ctrl); ctrl.Dispose();
To reproduce: Have a RadDock with a docked ToolWindow. Undock the ToolWindow by double-clicking it and dock it back. Now undock it by dragging it. If you now check the FloatingWindows collection you will see that there are two windows with the same name. Workaround: When iterating the windows, skip duplicates: HashSet<string> iteratedWindows = new HashSet<string>(); foreach (FloatingWindow win in this.radDock1.FloatingWindows) { if (iteratedWindows.Contains(win.Text)) { return; } win.Visible = hide; iteratedWindows.Add(win.Text); } Resolution: The FloatingWindows property gets a list of the floating windows, can contain duplicates, empty or hidden toolwindows which are used internally as re-dock targets. Use the ActiveFloatingWindows property instead of it.
To reproduce: - Add two MDI child forms to a RadDock. - Close the second one in the first one's close event. - Start the application and close the first form.
To reproduce : 1. Add three DocumentWindows. 2. Dock one of the windows to the top of the container. 3. The ActiveWindowChanged event is fired but the window is not marked as active. Clicking on this window does not take affect and it is still not activated. Please refer to the attached gif file. Workaround: public Form1() { InitializeComponent(); this.radDock1.ActiveWindowChanged += radDock1_ActiveWindowChanged; this.radDock1.DockStateChanged += radDock1_DockStateChanged; } private void radDock1_ActiveWindowChanged(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e) { UpdateSelectedFont(e); } private void radDock1_DockStateChanged(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e) { if (e.DockWindow.DockState == Telerik.WinControls.UI.Docking.DockState.Docked) { UpdateSelectedFont(e); } } private void UpdateSelectedFont(DockWindowEventArgs e) { foreach (DockWindow dw in this.radDock1.DockWindows.DocumentWindows) { if (dw.TabStripItem.Text == e.DockWindow.TabStripItem.Text) { dw.TabStripItem.Font = new Font(dw.TabStripItem.Font, FontStyle.Bold); } else { dw.TabStripItem.Font = new Font(dw.TabStripItem.Font, FontStyle.Regular); } } }
DECLINED: Currently, RadDock is designed to only persist the position of tool windows. The document windows are consider to be kind of dynamic content presenters which need to be opened/closed at runtime. ORIGINAL DESCRIPTION: Create a single ToolWindow, set its DockState to Floating, add this window to a RadDock. Start the application, hide the window, save the layout, then load the layout, the window is not hidden. In the xml there is no node with ToolWindow To reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); ToolWindow newTool = new ToolWindow(); newTool.Name = "New Tool"; newTool.CloseAction = DockWindowCloseAction.Hide; this.radDock1.AddDocument(newTool); newTool.DockState = DockState.Floating; this.radDock1.ActiveWindow = newTool; } private void radButton1_Click(object sender, EventArgs e) { this.radDock1.SaveToXml(@"..\..\layout1.xml"); } private void radButton2_Click(object sender, EventArgs e) { this.radDock1.LoadFromXml(@"..\..\layout1.xml"); } }
Workaround - set AutoScroll = false to Form that is being shows as MDI child
Workaround: use the RadDock.ActiveWindowChanging event instead.
The issue is caused by the fact that the drop down button has its own theming in RadDock, which gets applied to the newly added button. To reproduce: protected override void OnLoad(EventArgs e) { base.OnLoad(e); RadDockEvents.TabStripItemCreating += RadDockEvents_TabStripItemCreating; AddDock(); ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Dark"; } void RadDockEvents_TabStripItemCreating(object sender, TabStripItemCreatingEventArgs args) { RadDropDownButtonElement btn = new RadDropDownButtonElement(); btn.Margin = new System.Windows.Forms.Padding(80, 5, 5, 5); btn.MinSize = new System.Drawing.Size(50, 20); btn.Items.Add(new RadMenuItem("asasda")); args.TabItem.Children.Add(btn); } Workaround: use the themes in the attachments