バージョン

SetRelativeSize メソッド

SplitPane で子を持つスペースのパーセントを決定する SplitPane の子の RelativeSize を設定します。
シンタックス
'宣言
 
Public Shared Sub SetRelativeSize( _
   ByVal d As DependencyObject, _
   ByVal value As Size _
) 
public static void SetRelativeSize( 
   DependencyObject d,
   Size value
)

パラメータ

d
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);
}
<igDock:XamDockManager>
    
<igDock:XamDockManager.Panes>
        
<!-- The SplitterOrientation determine the orientation 
             of the splitter bar used to separate the children 
        
-->
        
<igDock:SplitPane SplitterOrientation="Horizontal"
                          
igDock:XamDockManager.InitialLocation="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.
            
-->
            
<igDock:ContentPane Header="Top" Content="Top" 
                                
igDock:SplitPane.RelativeSize="100, 200" />
            
<!-- 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
            
-->
            
<igDock:ContentPane Header="Bottom" Content="Bottom" 
                                
igDock:SplitPane.RelativeSize="100, 100" />
        
</igDock:SplitPane>

        
<!-- create a second root split pane with a vertical splitter 
             between the items. the "content" property of the split
             pane is its panes collection so the children elements 
             you add will be the children of the pane 
-->
        
<igDock:SplitPane SplitterOrientation="Vertical"
                          
igDock:XamDockManager.InitialLocation="DockedBottom">
            
<!-- Here the RelativeSize is not set so each gets an 
                 equal percentage and the available width will be 
                 evenly distributed between the panes 
-->
            
<igDock:ContentPane Header="Left" Content="Left" />
            
<igDock:TabGroupPane>
                
<igDock:ContentPane Header="Tab 1" Content="1" />
                
<igDock:ContentPane Header="Tab 2" Content="2" />
            
</igDock:TabGroupPane>
            
<igDock:ContentPane Header="Right" Content="Right" />
        
</igDock:SplitPane>
    
</igDock:XamDockManager.Panes>
</igDock:XamDockManager>
参照