'宣言 Public Shared Sub SetRelativeSize( _ ByVal d As DependencyObject, _ ByVal value As Size _ )
public static void SetRelativeSize( DependencyObject d, Size value )
SplitPane は、子の間のスペース配分を決定するために Panes コレクションの各表示可能な子の RelativeSize を使用します。SplitterOrientation に基づいて、RelativeSize の Width または Height を使用します。SplitPane の SplitterOrientation が Vertical の場合は、子が水平方向に配置され、RelativeSize の Width のみ評価されます。SplitterOrientation は Horizontal に設定された場合、子が垂直方向に配置されるため、RelativeSize の Height のみが評価されます。RelativeSize の比率は、指定した子に提供されるパーセンテージを決定するのに使用されます。例: 2 つの表示される子がある SplitPane。項目 1 の RelativeSize が 100x200 で項目 2 の RelativeSize が 200x50 です。SplitterOrientation が Horizontal の場合は、相対サイズの Height を使用します。この場合、項目 1 は 200、項目 2 は 50 の相対的な高さがあるため、相対的な高さの合計は 250 です。そのため、項目 1 は約 80 % (200/250) のスペースを受けて、項目 2 は約 20 % (50/250) のスペースを受けます。SplitPane の高さが 500 ピクセルの場合、項目 1 の高さは 400 (.80 * 500)、項目 2 の高さは 100 (.20 * 500) になります。項目の間に表示されるスプリッターのスペースがあるため、この値は正確ではないことに注意してください。
注: RelativeSize の最小の Width/Height は 1,1 です。したがって要素をより小さくリサイズする時に問題に繋がる可能性があるため小さすぎる値を使用しないことが推奨されます。
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); }