public DockWindow Deserialize(RadDock dock, RadSplitContainer splitContainer, RadDockComponentFactory componentFactory) { Guid guid = new Guid(this.DockGuid); DockWindow dockWindow = this.GetDockWindow(dock, guid, componentFactory); if (dockWindow != null) { this.ApplyDockWindowSettings(dockWindow); if (dock != null) { dock.OnDockableDeserialized(new Telerik.WinControls.Interfaces.DockableDeserializedEventArgs( dockWindow, guid)); } } return(dockWindow); //(window as IToolWindowLayoutController).CaptionVisible = bool.Parse(CaptionVisible); //(window as IToolWindowLayoutController).TabStripVisible = bool.Parse(TabStripVisible); //(window as IToolWindowLayoutController).CloseButtonVisible = bool.Parse(CloseButtonVisible); //(window as IToolWindowLayoutController).HideButtonVisible = bool.Parse(HideButtonVisible); //(window as IToolWindowLayoutController).DropDownButtonVisible = bool.Parse(DropDownButtonVisible); //((ISupportDockingInternal)window).SetDockManager(manager); ////host.CreateComponent //window.PreferredFloatSize = new Size(int.Parse(this.PreferredFloatSize.Split(';')[0]), int.Parse(this.PreferredFloatSize.Split(';')[1])); //window.DockPosition = (DockPosition)Enum.Parse(typeof(DockPosition), DockPosition); }
/// <summary> /// Creates a new FloatingWindow instance passing an owner RadDock instance as a parameter /// </summary> public FloatingWindow(RadDock dockManager) : base(dockManager) { base.FormBorderStyle = FormBorderStyle.SizableToolWindow; base.MaximizeBox = false; base.MinimizeBox = false; base.ShowInTaskbar = false; base.SizeGripStyle = SizeGripStyle.Hide; base.StartPosition = FormStartPosition.Manual; this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.dockContainer = new RadSplitContainer(); this.dockContainer.Dock = DockStyle.Fill; this.dockContainer.ThemeClassName = RadDock.DockSplitContainerThemeClassName; this.dockContainer.ControlAdded += OnDockContainer_ControlAdded; this.dockContainer.ControlRemoved += OnDockContainer_ControlRemoved; this.dockContainer.PanelCollapsedChanged += OnDockContainer_PanelCollapsedChanged; this.dockContainer.ControlTreeChanged += OnDockContainer_ControlTreeChanged; this.Controls.Add(this.dockContainer); if (dockManager != null) { this.dockContainer.ThemeName = dockManager.ThemeName; this.RightToLeft = dockManager.RightToLeft; } this.StartPosition = FormStartPosition.Manual; }
/// <summary> /// Defragments the tree of RadSplitContainer instances. /// Used by a RadDock control to clean-up unnecessary containers. /// </summary> /// <param name="parentContainer"></param> public static void MergeContainers(RadSplitContainer parentContainer) { if (parentContainer == null) { return; } parentContainer.SuspendLayout(); //first delegate to child containers to ensure proper merging with parents RadSplitContainer childContainer; for (int i = 0; i < parentContainer.SplitPanels.Count; i++) { childContainer = parentContainer.SplitPanels[i] as RadSplitContainer; if (childContainer != null) { MergeContainers(childContainer); } } //try to merge the current container with its parent if (parentContainer.MergeWithParentContainer()) { parentContainer.Dispose(); } else { parentContainer.ResumeLayout(true); } }
private static void AddPaneForViewModel(RadDocking dock, WindowViewModel model, Size?floatingSize, Point?floatingLocation) { var pane = new RadPane { DataContext = model }; pane.SetBinding(RadPane.IsHiddenProperty, new Binding("IsHidden") { Mode = BindingMode.TwoWay }); pane.SetBinding(RadPane.HeaderProperty, new Binding("Header")); var group = new RadPaneGroup { Items = { pane } }; var splitContainer = new RadSplitContainer { Items = { group } }; splitContainer.InitialPosition = DockState.FloatingOnly; if (floatingSize.HasValue) { RadDocking.SetFloatingSize(splitContainer, floatingSize.Value); } if (floatingLocation.HasValue) { RadDocking.SetFloatingLocation(splitContainer, floatingLocation.Value); } dock.Items.Add(splitContainer); }
/// <summary> /// Gets a list with all the descendant panels which SizeMode is SplitPanelSizeMode.Fill /// </summary> /// <param name="container"></param> private void FindFillPanels(RadSplitContainer container) { foreach (SplitPanel panel in container.SplitPanels) { if (panel.Collapsed) { continue; } if (panel.SizeInfo.SizeMode == SplitPanelSizeMode.Fill) { this.layoutInfo.fillPanel = panel; break; } RadSplitContainer childContainer = panel as RadSplitContainer; if (childContainer != null && this.ContainsFillPanel(childContainer)) { this.layoutInfo.fillPanel = childContainer; } if (this.layoutInfo.fillPanel != null) { break; } } }
private void CreateNewOuterDocument(object param) { var tempInnerDockPanes = new ObservableCollection <RadPane>() { new RadPane() { Header = "Inner Pane", Tag = "DocumentHost" }, }; var radPaneGroup = new RadPaneGroup() { Name = "DocumentHostPane" + innerDockingNumber }; innerDockingNumber++; var radSplitContainer = new RadSplitContainer(); radSplitContainer.Items.Add(radPaneGroup); var tempInnerDock = new RadDocking() { DockingPanesFactory = new CustomDockingPanesFactory(), DocumentHost = radSplitContainer }; // Set correct PanesSource for hte inner RadDocking tempInnerDock.PanesSource = tempInnerDockPanes; this.OuterDockPanes.Add(new RadPane() { Header = "New Outer Pane " + Guid.NewGuid(), Content = tempInnerDock, Tag = "DocumentHost" }); }
private void CreateGrid(int cols, int rows, Orientation orientation, bool centerFill) { this.BeginLayout(); this.rootContainer.Orientation = orientation; for (int i = 0; i < rows; i++) { RadSplitContainer container = new RadSplitContainer(); container.Orientation = Orientation.Vertical; container.SizeInfo.AbsoluteSize = new Size(100, 100); for (int j = 0; j < cols; j++) { SplitPanel panel = this.CreateSplitPanel(); panel.SizeInfo.AbsoluteSize = new Size(100, 100); container.SplitPanels.Add(panel); } this.rootContainer.SplitPanels.Add(container); } if (centerFill) { (this.rootContainer.SplitPanels[rows / 2] as RadSplitContainer).SplitPanels[cols / 2].SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Fill; } this.EndLayout(); }
protected virtual void Layout(RadSplitContainer container) { int layoutOffset = this.GetLayoutOffset(); int availableLength = this.layoutInfo.availableLength; int count = this.layoutInfo.LayoutTargets.Count; for (int panelIndex = 0; panelIndex < count; ++panelIndex) { SplitPanel layoutTarget = this.layoutInfo.LayoutTargets[panelIndex]; int num = layoutTarget.SizeInfo.MeasuredLength; if (panelIndex == count - 1) { num = availableLength; } Rectangle rectangle; Rectangle bounds; if (this.layoutInfo.Orientation == Orientation.Vertical) { rectangle = new Rectangle(layoutOffset, this.layoutInfo.contentRect.Top, num, this.layoutInfo.contentRect.Height); bounds = new Rectangle(rectangle.Left - this.layoutInfo.splitterLength, rectangle.Top, this.layoutInfo.splitterLength, rectangle.Height); } else { rectangle = new Rectangle(this.layoutInfo.contentRect.Left, layoutOffset, this.layoutInfo.contentRect.Width, num); bounds = new Rectangle(rectangle.Left, rectangle.Top - this.layoutInfo.splitterLength, rectangle.Width, this.layoutInfo.splitterLength); } layoutTarget.Bounds = rectangle; layoutOffset += num + this.layoutInfo.splitterLength; availableLength -= num + this.layoutInfo.splitterLength; if (panelIndex > 0) { container.UpdateSplitter(this.layoutInfo, panelIndex, bounds); } } }
private void AddPaneWithSerializationTagButtonClick(object sender, RoutedEventArgs e) { RadPane radPane = new RadPane() { Title = "New RadPane with SerializationTag", Name = "NewRadPane" }; radPane.Content = new TextBox() { Text = "TextBox" }; RadDocking.SetSerializationTag(radPane, "NewRadPane"); RadPaneGroup radPaneGroup = new RadPaneGroup(); RadSplitContainer radSplitContainer = new RadSplitContainer() { InitialPosition = DockState.FloatingDockable }; RadDocking.SetFloatingLocation(radSplitContainer, new Point(700, 130)); RadDocking.SetFloatingSize(radSplitContainer, new Size(500, 200)); radPaneGroup.Items.Add(radPane); radSplitContainer.Items.Add(radPaneGroup); this.Docking.Items.Add(radSplitContainer); DisableButton(sender); }
/// <summary> /// Finds the first RadSplitContainer instance, which contains both specified panels. /// </summary> /// <param name="child1"></param> /// <param name="child2"></param> /// <returns></returns> public static RadSplitContainer FindCommonAncestor(SplitPanel child1, SplitPanel child2) { if (child1 == null || child2 == null) { return(null); } RadSplitContainer container1 = child1.SplitContainer; RadSplitContainer container2 = child2.SplitContainer; while (container1 != null && container2 != null) { if (ControlHelper.IsDescendant(container1, child2)) { return(container1); } if (ControlHelper.IsDescendant(container2, child1)) { return(container2); } container1 = container1.SplitContainer; container2 = container2.SplitContainer; } return(null); }
/// <summary> /// Updates the layout info for a pending layout operation. /// </summary> /// <param name="container"></param> protected virtual void UpdateLayoutInfo(RadSplitContainer container) { this.layoutInfo.contentRect = container.ContentRectangle; this.layoutInfo.orientation = container.Orientation; this.layoutInfo.availableLength = this.GetLength(this.layoutInfo.contentRect.Size); this.layoutInfo.autoSizeLength = this.layoutInfo.availableLength; this.layoutInfo.splitterLength = container.SplitterWidth; //collect layout targets int count = container.SplitPanels.Count; for (int i = 0; i < count; i++) { SplitPanel panel = container.SplitPanels[i]; if (panel.Collapsed) { continue; } this.layoutInfo.layoutTargets.Add(panel); SplitPanelSizeInfo sizeInfo = panel.SizeInfo; sizeInfo.minLength = this.GetLength(this.GetMinimumSize(panel)); this.layoutInfo.totalMinLength += sizeInfo.minLength; switch (sizeInfo.SizeMode) { case SplitPanelSizeMode.Absolute: int length = this.GetLength(sizeInfo.AbsoluteSize); if (length > 0) { this.layoutInfo.autoSizeLength -= length; this.layoutInfo.absoluteSizeTargets.Add(panel); } else { this.layoutInfo.autoSizeTargets.Add(panel); } break; case SplitPanelSizeMode.Auto: case SplitPanelSizeMode.Relative: this.layoutInfo.autoSizeTargets.Add(panel); break; } } if (this.layoutInfo.layoutTargets.Count > 0) { this.layoutInfo.totalSplitterLength = (this.layoutInfo.layoutTargets.Count - 1) * this.layoutInfo.splitterLength; } if (this.layoutInfo.autoSizeTargets.Count > 0) { this.layoutInfo.autoSizeCountFactor = 1F / this.layoutInfo.autoSizeTargets.Count; this.layoutInfo.autoSizeLength -= (this.layoutInfo.autoSizeTargets.Count - 1) * this.layoutInfo.splitterLength; } }
/// <summary> /// Gets the minimum size for the specified split panel. /// If it is a container, the sum of minimum sizes of all child panels is calculated. /// </summary> /// <param name="panel"></param> /// <returns></returns> protected internal virtual Size GetMinimumSize(SplitPanel panel) { Size defaultMin = panel.SizeInfo.MinimumSize; RadSplitContainer container = panel as RadSplitContainer; if (container == null) { return(defaultMin); } int count = container.SplitPanels.Count; if (count <= 1) { return(defaultMin); } int minWidth = 0; int minHeight = 0; for (int i = 0; i < count; i++) { SplitPanel childPanel = container.SplitPanels[i]; if (childPanel.Collapsed) { continue; } Size minSize = this.GetMinimumSize(childPanel); switch (container.Orientation) { case Orientation.Horizontal: minWidth = Math.Max(minWidth, minSize.Width); minHeight += minSize.Height; if (i < count - 1) { minHeight += container.SplitterWidth; } break; case Orientation.Vertical: minWidth += minSize.Width; if (i < count - 1) { minWidth += container.SplitterWidth; } minHeight = Math.Max(minHeight, minSize.Height); break; } } minWidth = Math.Max(minWidth, defaultMin.Width); minHeight = Math.Max(minHeight, defaultMin.Height); return(new Size(minWidth, minHeight)); }
private void AddThreePanels() { RadSplitContainer rootContainer = new RadSplitContainer(); for (int i = 0; i < 3; i++) { rootContainer.SplitPanels.Add(new SplitPanel()); } }
/// <summary> /// Asks all <see cref="DockTabStrip">DockTabStrip</see> instances to check whether they need to be collapsed or disposed. /// Used in a clean-up pass of RadDock for a control tree defragmentation. /// </summary> /// <param name="container"></param> /// <param name="dockManager"></param> public static void CollapseOrDisposeStrips(RadSplitContainer container, RadDock dockManager) { foreach (DockTabStrip strip in ControlHelper.GetChildControls <DockTabStrip>(container, true)) { if (strip.DockManager == dockManager) { strip.CheckCollapseOrDispose(); } } }
private void ButtonFloating_Click(object sender, RoutedEventArgs e) { var splitContainer = new RadSplitContainer(); var paneGroup = new RadPaneGroup(); var pane = new RadPane { Header = "Floating pane" }; RadDocking.SetFloatingLocation(pane, new Point(100, 100)); paneGroup.Items.Add(pane); splitContainer.Items.Add(paneGroup); dock.Items.Add(splitContainer); pane.MakeFloatingDockable(); }
private void AddPaneButtonClick(object sender, RoutedEventArgs e) { RadPane radPane = new RadPane() { Title = "New sample RadPane" }; radPane.Content = new TextBox() { Text = "TextBox" }; RadPaneGroup radPaneGroup = new RadPaneGroup(); RadSplitContainer radSplitContainer = new RadSplitContainer() { InitialPosition = DockState.FloatingDockable }; RadDocking.SetFloatingLocation(radSplitContainer, new Point(400, 400)); RadDocking.SetFloatingSize(radSplitContainer, new Size(200, 100)); radPaneGroup.Items.Add(radPane); radSplitContainer.Items.Add(radPaneGroup); this.Docking.Items.Add(radSplitContainer); }
private void ClearEmptySplitContainer(RadSplitContainer splitContainer) { if (splitContainer.SplitPanels.Count == 0) { RadSplitContainer parentSplitContainer = splitContainer.SplitContainer; if (parentSplitContainer != null) { parentSplitContainer.SplitPanels.Remove(splitContainer); this.ClearEmptySplitContainer(parentSplitContainer); } } }
protected internal virtual Size GetMinimumSize(SplitPanel panel) { Size minimumSize1 = panel.SizeInfo.MinimumSize; RadSplitContainer radSplitContainer = panel as RadSplitContainer; if (radSplitContainer == null) { return(minimumSize1); } int count = radSplitContainer.SplitPanels.Count; if (count <= 1) { return(minimumSize1); } int val1_1 = 0; int val1_2 = 0; for (int index = 0; index < count; ++index) { SplitPanel splitPanel = radSplitContainer.SplitPanels[index]; if (!splitPanel.Collapsed) { Size minimumSize2 = this.GetMinimumSize(splitPanel); switch (radSplitContainer.Orientation) { case Orientation.Horizontal: val1_1 = Math.Max(val1_1, minimumSize2.Width); val1_2 += minimumSize2.Height; if (index < count - 1) { val1_2 += radSplitContainer.SplitterWidth; continue; } continue; case Orientation.Vertical: val1_1 += minimumSize2.Width; if (index < count - 1) { val1_1 += radSplitContainer.SplitterWidth; } val1_2 = Math.Max(val1_2, minimumSize2.Height); continue; default: continue; } } } return(new Size(Math.Max(val1_1, minimumSize1.Width), Math.Max(val1_2, minimumSize1.Height))); }
protected virtual void UpdateLayoutInfo(RadSplitContainer container) { this.layoutInfo.contentRect = container.ContentRectangle; this.layoutInfo.orientation = container.Orientation; this.layoutInfo.availableLength = this.GetLength(this.layoutInfo.contentRect.Size); this.layoutInfo.autoSizeLength = this.layoutInfo.availableLength; this.layoutInfo.splitterLength = container.SplitterWidth; int count = container.SplitPanels.Count; for (int index = 0; index < count; ++index) { SplitPanel splitPanel = container.SplitPanels[index]; if (!splitPanel.Collapsed) { this.layoutInfo.layoutTargets.Add(splitPanel); SplitPanelSizeInfo sizeInfo = splitPanel.SizeInfo; sizeInfo.minLength = this.GetLength(this.GetMinimumSize(splitPanel)); this.layoutInfo.totalMinLength += sizeInfo.minLength; switch (sizeInfo.SizeMode) { case SplitPanelSizeMode.Auto: case SplitPanelSizeMode.Relative: this.layoutInfo.autoSizeTargets.Add(splitPanel); continue; case SplitPanelSizeMode.Absolute: int length = this.GetLength(sizeInfo.AbsoluteSize); if (length > 0) { this.layoutInfo.autoSizeLength -= length; this.layoutInfo.absoluteSizeTargets.Add(splitPanel); continue; } this.layoutInfo.autoSizeTargets.Add(splitPanel); continue; default: continue; } } } if (this.layoutInfo.layoutTargets.Count > 0) { this.layoutInfo.totalSplitterLength = (this.layoutInfo.layoutTargets.Count - 1) * this.layoutInfo.splitterLength; } if (this.layoutInfo.autoSizeTargets.Count <= 0) { return; } this.layoutInfo.autoSizeCountFactor = 1f / (float)this.layoutInfo.autoSizeTargets.Count; this.layoutInfo.autoSizeLength -= (this.layoutInfo.autoSizeTargets.Count - 1) * this.layoutInfo.splitterLength; }
private void DeserializeChildNode(XmlDockNode node, RadSplitContainer splitContainer, RadSplitContainer childSplitContainer, IList <SplitPanel> panelList, RadDockComponentFactory componentFactory, RadDock dock) { if (node != null) { RadSplitContainer container = (childSplitContainer != null) ? childSplitContainer : splitContainer; List <SplitPanel> splitPanels = node.DeserializeNode(dock, container, componentFactory); foreach (SplitPanel panel in splitPanels) { panelList.Add(panel); } } }
private void AddButton_Click(object sender, RoutedEventArgs e) { var split = new RadSplitContainer(); var group = new RadPaneGroup(); var pane = new RadPane(); group.Items.Add(pane); split.Items.Add(group); split.InitialPosition = Telerik.Windows.Controls.Docking.DockState.DockedTop; RadDocking.SetIsAutoGenerated(group, true); RadDocking.SetIsAutoGenerated(split, true); this.docking.Items.Add(split); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="floatingWindow"></param> public SerializableFloatingWindow(FloatingWindow floatingWindow) { //copy properties for seriazliation this.dockContainer = floatingWindow.DockContainer; this.ClientSize = floatingWindow.ClientSize; this.Location = floatingWindow.Location; this.BackColor = floatingWindow.BackColor; this.zIndex = floatingWindow.ZIndex; //TODO //this.AllowTheming = floatingWindow.AllowTheming; //this.AllowTransparency = floatingWindow.AllowTransparency; //this.BackgroundImage = floatingWindow.BackgroundImage; //this.BackgroundImageLayout = floatingWindow.BackgroundImageLayout; }
/// <summary> /// Collects all the RadSplitContainer instances, residing on the specified parent, and associated with the provided RadDock instance. /// </summary> /// <param name="parent"></param> /// <param name="recursive"></param> /// <param name="dockManager"></param> /// <returns></returns> public static List <RadSplitContainer> GetSplitContainers(Control parent, bool recursive, RadDock dockManager) { List <RadSplitContainer> descendants = new List <RadSplitContainer>(); foreach (Control child in ControlHelper.EnumChildControls(parent, recursive)) { RadSplitContainer container = child as RadSplitContainer; if (container != null && ControlHelper.FindAncestor <RadDock>(container) == dockManager) { descendants.Add(container); } } return(descendants); }
//// ex: //// Enable Collapsing + Hide SplitPanel // radSplitContainer1.UseSplitterButtons = true; // radSplitContainer1.EnableCollapsing = true; // splitPanel1.Collapsed = true; // if (txt == "Show Tree") { splitPanel1.Collapsed = false; } // if (txt == "Hide Tree") { splitPanel1.Collapsed = true; } /// <summary> /// You can programmatically build a layout of panels using RadSplitContainer. To do so, refer to the code snippet below: /// </summary> /// <param name="RForm">RadForm to Add Controls To</param> public void BuildExample(RadForm RForm) { RadSplitContainer container = new RadSplitContainer(); container.Dock = DockStyle.Fill; //left panel, sized absolutely RadSplitContainer leftContainer = new RadSplitContainer(); leftContainer.Orientation = Orientation.Horizontal; leftContainer.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Absolute; leftContainer.SizeInfo.AbsoluteSize = new Size(150, 150); container.SplitPanels.Add(leftContainer); //middle panel, auto-sized SplitPanel middlePanel = new SplitPanel(); middlePanel.SplitPanelElement.Fill.BackColor = Color.Pink; container.SplitPanels.Add(middlePanel); //left panel, sized absolutely RadSplitContainer rightContainer = new RadSplitContainer(); rightContainer.Orientation = Orientation.Horizontal; rightContainer.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Absolute; rightContainer.SizeInfo.AbsoluteSize = new Size(150, 150); container.SplitPanels.Add(rightContainer); //add panels 4 & 5 SplitPanel leftTopPanel = new SplitPanel(); leftContainer.SplitPanelElement.Fill.BackColor = Color.Yellow; leftTopPanel.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Absolute; leftTopPanel.SizeInfo.AbsoluteSize = new Size(150, 150); leftContainer.SplitPanels.Add(leftTopPanel); SplitPanel leftBottomPanel = new SplitPanel(); leftBottomPanel.SplitPanelElement.Fill.BackColor = Color.Green; leftContainer.SplitPanels.Add(leftBottomPanel); //add panels 6 & 7 SplitPanel rightTopPanel = new SplitPanel(); rightTopPanel.SplitPanelElement.Fill.BackColor = Color.Red; rightTopPanel.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Absolute; rightTopPanel.SizeInfo.AbsoluteSize = new Size(150, 150); rightContainer.SplitPanels.Add(rightTopPanel); SplitPanel rightBottomPanel = new SplitPanel(); rightBottomPanel.SplitPanelElement.Fill.BackColor = Color.Lime; rightContainer.SplitPanels.Add(rightBottomPanel); RForm.Controls.Add(container); }
private void RemoveOldContainers(RadDock dock) { foreach (TabStripPanel tabPanel in XmlDockingManager.OldContainers) { if (tabPanel != null && tabPanel.TabPanels.Count == 0) { RadSplitContainer splitContainer = tabPanel.SplitContainer; if (splitContainer != null) { splitContainer.SplitPanels.Remove(tabPanel); this.ClearEmptySplitContainer(splitContainer); } } } XmlDockingManager.OldContainers = null; }
/// <summary> /// Traverses the tree of split containers and finds the panel, /// which is direct child of the specified container and contains the specified split panel as a descendant. /// </summary> /// <param name="container"></param> /// <param name="descendant"></param> /// <returns></returns> public static SplitPanel GetDirectChildContainingPanel(RadSplitContainer container, SplitPanel descendant) { RadSplitContainer parent = container; SplitPanel curr = descendant; while (parent != null) { if (parent.SplitPanels.IndexOf(curr) != -1) { return(curr); } curr = curr.SplitContainer; } return(null); }
/// <summary> /// Performs the core layout logic. Updates each panel's bounds, keeping in mind restrictions like Minimum and Maximum size. /// </summary> /// <param name="container"></param> protected virtual void Layout(RadSplitContainer container) { SplitPanel panel; Rectangle panelBounds; Rectangle splitterBounds; int length = 0; int offset = this.GetLayoutOffset(); int remaining = this.layoutInfo.availableLength; int count = this.layoutInfo.LayoutTargets.Count; for (int i = 0; i < count; i++) { panel = this.layoutInfo.LayoutTargets[i]; SplitPanelSizeInfo sizeInfo = panel.SizeInfo; length = sizeInfo.measuredLength; if (i == count - 1) { length = remaining; } switch (this.layoutInfo.Orientation) { case Orientation.Vertical: panelBounds = new Rectangle(offset, this.layoutInfo.contentRect.Top, length, this.layoutInfo.contentRect.Height); splitterBounds = new Rectangle(panelBounds.Left - this.layoutInfo.splitterLength, panelBounds.Top, this.layoutInfo.splitterLength, panelBounds.Height); break; default: panelBounds = new Rectangle(this.layoutInfo.contentRect.Left, offset, this.layoutInfo.contentRect.Width, length); splitterBounds = new Rectangle(panelBounds.Left, panelBounds.Top - this.layoutInfo.splitterLength, panelBounds.Width, this.layoutInfo.splitterLength); break; } panel.Bounds = panelBounds; offset += (length + this.layoutInfo.splitterLength); remaining -= (length + this.layoutInfo.splitterLength); if (i > 0) { container.UpdateSplitter(this.layoutInfo, i, splitterBounds); } } }
public virtual void PerformLayout(RadSplitContainer container) { this.layoutInfo.Reset(); this.FindFillPanels(container); this.UpdateLayoutInfo(container); if (this.layoutInfo.layoutTargets.Count == 0) { return; } if (this.layoutInfo.layoutTargets.Count == 1) { this.layoutInfo.layoutTargets[0].Bounds = this.layoutInfo.contentRect; } else { this.Measure(); this.Layout(container); } }
private static void AddPaneForViewModel(RadDocking dock, WindowViewModel model, Size? floatingSize, Point? floatingLocation) { var pane = new RadPane { DataContext = model }; pane.SetBinding(RadPane.IsHiddenProperty, new Binding("IsHidden") { Mode = BindingMode.TwoWay }); pane.SetBinding(RadPane.HeaderProperty, new Binding("Header")); var group = new RadPaneGroup { Items = { pane } }; var splitContainer = new RadSplitContainer { Items = { group } }; splitContainer.InitialPosition = DockState.FloatingOnly; if (floatingSize.HasValue) { RadDocking.SetFloatingSize(splitContainer, floatingSize.Value); } if (floatingLocation.HasValue) { RadDocking.SetFloatingLocation(splitContainer, floatingLocation.Value); } dock.Items.Add(splitContainer); }
public ViewModel() { this.OuterDockPanes = new ObservableCollection <RadPane>(); this.InnerDockPanes1 = new ObservableCollection <RadPane>() { new RadPane() { Header = "Inner Pane 1", Tag = "DocumentHost" }, new RadPane() { Header = "Inner Pane 2", Tag = "DocumentHost" }, new RadPane() { Header = "Inner Pane 3", Tag = "DocumentHost" } }; var radPaneGroup = new RadPaneGroup() { Name = "InnerDocumentHostPane" + innerDockingNumber }; innerDockingNumber++; var radSplitContainer = new RadSplitContainer(); radSplitContainer.Items.Add(radPaneGroup); var tempInnerDock = new RadDocking() { DockingPanesFactory = new CustomDockingPanesFactory(), DocumentHost = radSplitContainer }; // Set correct PanesSource for hte inner RadDocking tempInnerDock.PanesSource = this.InnerDockPanes1; this.OuterDockPanes.Add(new RadPane() { Header = "Outer Pane 1", Content = tempInnerDock, Tag = "DocumentHost" }); }
private RadSplitContainer GenerateRadSplitContainer(CreatedDockingContainer dockingContainer) { var radSplitContainer = new RadSplitContainer { Tag = dockingContainer, InitialPosition = FromDockingPositionToDockState(dockingContainer.DockingContainerMetaData.InitDockingPosition), Orientation = dockingContainer.DockingContainerMetaData.Orientation }; foreach (var dockingGroup in _mefDockingGroups) { if (dockingGroup.DockingGroupMetaData.ContainerGUID != dockingContainer.DockingContainerMetaData.GUID) { continue; } var radPaneGroup = GenerateRadPaneGroup(dockingGroup); radSplitContainer.Items.Add(radPaneGroup); } return(radSplitContainer); }
public List <SplitPanel> DeserializeNode(RadDock dock, RadSplitContainer splitContainer, RadDockComponentFactory componentFactory) { List <SplitPanel> splitPanelList = new List <SplitPanel>(); TabStripPanel dockableContainer = this.CreateDockableContainer(this.Dockables, componentFactory); if (dockableContainer != null) { foreach (XmlDockable dockable in this.Dockables) { TabPanel panel = dockable.Deserialize(dock, splitContainer, componentFactory); dockableContainer.TabPanels.Add(panel); } this.ProcessDockableContainer(dockableContainer, dock, splitPanelList, componentFactory); } RadSplitContainer childSplitContainer = null; IList <SplitPanel> tempList = splitPanelList; if (XmlDockNode.HasBothChildren(this)) { Orientation orientation = XmlDockNode.GetReversedOrientation(this); if (orientation != splitContainer.Orientation) { childSplitContainer = this.CreateSplitContainer(dock, componentFactory); if (childSplitContainer != null) { childSplitContainer.Orientation = orientation; splitPanelList.Add(childSplitContainer); tempList = childSplitContainer.SplitPanels; } } } this.DeserializeChildNode(this.Left, splitContainer, childSplitContainer, tempList, componentFactory, dock); this.DeserializeChildNode(this.Right, splitContainer, childSplitContainer, tempList, componentFactory, dock); return(splitPanelList); }
public ViewModel() { this.OuterDockPanes = new ObservableCollection<RadPane>(); this.InnerDockPanes1 = new ObservableCollection<RadPane>() { new RadPane() { Header = "Inner Pane 1", Tag = "DocumentHost" }, new RadPane() { Header = "Inner Pane 2", Tag = "DocumentHost" }, new RadPane() { Header = "Inner Pane 3", Tag = "DocumentHost" } }; var radPaneGroup = new RadPaneGroup() { Name = "InnerDocumentHostPane" + innerDockingNumber }; innerDockingNumber++; var radSplitContainer = new RadSplitContainer(); radSplitContainer.Items.Add(radPaneGroup); var tempInnerDock = new RadDocking() { DockingPanesFactory = new CustomDockingPanesFactory(), DocumentHost = radSplitContainer }; // Set correct PanesSource for hte inner RadDocking tempInnerDock.PanesSource = this.InnerDockPanes1; this.OuterDockPanes.Add(new RadPane() { Header = "Outer Pane 1", Content = tempInnerDock, Tag = "DocumentHost" }); }
private void CreateNewOuterDocument(object param) { var tempInnerDockPanes = new ObservableCollection<RadPane>() { new RadPane() { Header = "Inner Pane", Tag = "DocumentHost" }, }; var radPaneGroup = new RadPaneGroup() { Name = "DocumentHostPane" + innerDockingNumber }; innerDockingNumber++; var radSplitContainer = new RadSplitContainer(); radSplitContainer.Items.Add(radPaneGroup); var tempInnerDock = new RadDocking() { DockingPanesFactory = new CustomDockingPanesFactory(), DocumentHost = radSplitContainer }; // Set correct PanesSource for hte inner RadDocking tempInnerDock.PanesSource = tempInnerDockPanes; this.OuterDockPanes.Add(new RadPane() { Header = "New Outer Pane " + Guid.NewGuid(), Content = tempInnerDock, Tag = "DocumentHost" }); }