'Declaration Public Shared Sub SetRelativeSize( _ ByVal d As DependencyObject, _ ByVal value As Size _ )
public static void SetRelativeSize( DependencyObject d, Size value )
The SplitPane uses the RelativeSize of each visible child in its Panes collection to determine how to distribute the space between the children. Depending upon the SplitterOrientation, either the Width or Height of the RelativeSize will be used. When the SplitterOrientation of the SplitPane is Vertical, the children are arranged horizontally and therefore only the Width of the RelativeSize is evaluated. When the SplitterOrientation is Horizontal, the children are arranged vertically and therefore only the Height of the RelativeSize is evaluated. The ratio of RelativeSize is used to determine the percentange that a given child is provided. For example, consider a SplitPane that has 2 visible children - item 1 has a RelativeSize of 100x200 and item 2 has a RelativeSize of 200x50. If the SplitterOrientation is Horizontal, the Height of relative sizes are used. In this case that means there is a total relative height of 250 (item 1 has a relative height of 200 and item 2 has a relative height of 50) and so item 1 would get ~80 (i.e. 200/250) and item 2 would get ~20 (50/250). So if the SplitPane is 500 pixels tall, item 1 will have a height of 400 (.80 * 500) and item 2 will have a height of 100 (.20 * 500). Note, this value won't be exact since space must be provided to the Splitter displayed between the items.
Note: The minimum Width/Height for the RelativeSize is 1,1 so it is recommended that you not use values that are too small as that could leads to problems when resizing the element smaller.
Imports Infragistics.Windows.DockManager Private Sub InitializeDmSplitPanes(ByVal dockManager As XamDockManager) Dim splitHorz As New SplitPane() ' The SplitterOrientation determine the orientation ' of the splitter bar used to separate the children splitHorz.SplitterOrientation = Orientation.Horizontal ' since this will be a root split pane, we will initialize ' the default location such that it is docked on the left ' edge of the dockmanager XamDockManager.SetInitialLocation(splitHorz, InitialPaneLocation.DockedLeft) ' The RelativeSize is an attached property that is used ' to determine the percentage of the available space that ' should be assigned to the pane. In this example, since ' the splitter orientation is horizontal only the height ' will affect the size. The top pane will be given 2/3 ' of the available height since it has a relative size ' of 200/300 whereas the bottom pane has a relative size ' of 100/300. Dim cpTop As New ContentPane() cpTop.Header = "Top" cpTop.Content = "Top" SplitPane.SetRelativeSize(cpTop, New Size(100, 200)) Dim cpBottom As New ContentPane() cpBottom.Header = "Bottom" cpBottom.Content = "Bottom" SplitPane.SetRelativeSize(cpTop, New Size(100, 100)) ' note, the order in which the panes are added ' has an impact on their position. the first visible ' item is positioned on the left/top depending on ' the splitter orientation with the next pane following ' to the right/bottom respectively splitHorz.Panes.Add(cpTop) splitHorz.Panes.Add(cpBottom) ' create a second root split pane with a vertical splitter between ' the items Dim splitVert As New SplitPane() splitVert.SplitterOrientation = Orientation.Vertical XamDockManager.SetInitialLocation(splitVert, InitialPaneLocation.DockedBottom) ' Here the RelativeSize is not set so each gets an ' equal percentage and the available width will be ' evenly distributed between the panes Dim cpLeft As New ContentPane() cpLeft.Content = "Left" cpLeft.Header = "Left" splitVert.Panes.Add(cpLeft) Dim tgMiddle As New TabGroupPane() Dim cpTab1 As New ContentPane() cpTab1.Header = "Tab 1" cpTab1.Content = "1" tgMiddle.Items.Add(cpTab1) Dim cpTab2 As New ContentPane() cpTab2.Header = "Tab 2" cpTab2.Content = "2" tgMiddle.Items.Add(cpTab2) splitVert.Panes.Add(tgMiddle) Dim cpRight As New ContentPane() cpRight.Header = "Right" cpRight.Content = "Right" splitVert.Panes.Add(cpRight) dockManager.Panes.Add(splitHorz) dockManager.Panes.Add(splitVert) End Sub
using Infragistics.Windows.DockManager; private void InitializeDmSplitPanes(XamDockManager dockManager) { SplitPane splitHorz = new SplitPane(); // The SplitterOrientation determine the orientation // of the splitter bar used to separate the children splitHorz.SplitterOrientation = Orientation.Horizontal; // since this will be a root split pane, we will initialize // the default location such that it is docked on the left // edge of the dockmanager XamDockManager.SetInitialLocation(splitHorz, InitialPaneLocation.DockedLeft); // The RelativeSize is an attached property that is used // to determine the percentage of the available space that // should be assigned to the pane. In this example, since // the splitter orientation is horizontal only the height // will affect the size. The top pane will be given 2/3 // of the available height since it has a relative size // of 200/300 whereas the bottom pane has a relative size // of 100/300. ContentPane cpTop = new ContentPane(); cpTop.Header = "Top"; cpTop.Content = "Top"; SplitPane.SetRelativeSize(cpTop, new Size(100, 200)); ContentPane cpBottom = new ContentPane(); cpBottom.Header = "Bottom"; cpBottom.Content = "Bottom"; SplitPane.SetRelativeSize(cpTop, new Size(100, 100)); // note, the order in which the panes are added // has an impact on their position. the first visible // item is positioned on the left/top depending on // the splitter orientation with the next pane following // to the right/bottom respectively splitHorz.Panes.Add(cpTop); splitHorz.Panes.Add(cpBottom); // create a second root split pane with a vertical splitter between // the items SplitPane splitVert = new SplitPane(); splitVert.SplitterOrientation = Orientation.Vertical; XamDockManager.SetInitialLocation(splitVert, InitialPaneLocation.DockedBottom); // Here the RelativeSize is not set so each gets an // equal percentage and the available width will be // evenly distributed between the panes ContentPane cpLeft = new ContentPane(); cpLeft.Content = "Left"; cpLeft.Header = "Left"; splitVert.Panes.Add(cpLeft); TabGroupPane tgMiddle = new TabGroupPane(); ContentPane cpTab1 = new ContentPane(); cpTab1.Header = "Tab 1"; cpTab1.Content = "1"; tgMiddle.Items.Add(cpTab1); ContentPane cpTab2 = new ContentPane(); cpTab2.Header = "Tab 2"; cpTab2.Content = "2"; tgMiddle.Items.Add(cpTab2); splitVert.Panes.Add(tgMiddle); ContentPane cpRight = new ContentPane(); cpRight.Header = "Right"; cpRight.Content = "Right"; splitVert.Panes.Add(cpRight); dockManager.Panes.Add(splitHorz); dockManager.Panes.Add(splitVert); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2