/// <summary> /// Clone <see cref="IDockWindow"/> object. /// </summary> /// <param name="source">The source object.</param> /// <returns>The new instance or reference</returns> public static IDockWindow?CloneDockWindow(IDockWindow source) { source.Save(); var target = source.Factory?.CreateDockWindow(); if (!(target is null)) { CloneDockWindowProperties(source, target); } return(target); }
/// <summary> /// Clones <see cref="IDockWindow"/> object. /// </summary> /// <param name="source">The source object.</param> /// <returns>TThe new instance or reference of the <see cref="IDockWindow"/> class.</returns> public static IDockWindow CloneDockWindow(IDockWindow source) { source.Save(); var dockWindow = source.Factory.CreateDockWindow(); dockWindow.Id = source.Id; dockWindow.X = source.X; dockWindow.Y = source.Y; dockWindow.Width = source.Width; dockWindow.Height = source.Height; dockWindow.Topmost = source.Topmost; dockWindow.Title = source.Title; dockWindow.Layout = (IRootDock)source.Layout?.Clone(); if (dockWindow.Layout is IRootDock rootDock) { rootDock.Window = dockWindow; } return(dockWindow); }