| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

「WPF レイアウト サンプル」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
 
(同じ利用者による、間の1版が非表示)
1行目: 1行目:
==WPF レイアウト サンプル==
+
==[[WPF レイアウト サンプル]]==
[[WPF][WPF レイアウト]]
+
[[WPF]] | [[WPF レイアウト]] |
  
 
===Explorer風===
 
===Explorer風===
7行目: 7行目:
 
*ShowGridLines="True" でグリッドレイアウトの分割を可視化
 
*ShowGridLines="True" でグリッドレイアウトの分割を可視化
 
  <DockPanel>
 
  <DockPanel>
     <Button Content="Menu" DockPanel.Dock="Top"/>
+
     <Button Content="[[Menu]]" DockPanel.Dock="Top"/>
 
     <Button Content="Status" DockPanel.Dock="Bottom"/>
 
     <Button Content="Status" DockPanel.Dock="Bottom"/>
 
     <Grid ShowGridLines="True">
 
     <Grid ShowGridLines="True">
15行目: 15行目:
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
         </Grid.ColumnDefinitions>
 
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
+
         <Grid.[[R]]owDefinitions>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
             <RowDefinition Height="Auto"/>
+
             <[[R]]owDefinition Height="Auto"/>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
         </Grid.RowDefinitions>
+
         </Grid.[[R]]owDefinitions>
         <Button Grid.Column="0" Grid.Row="0"  Content="Left Top"/>
+
         <Button Grid.Column="0" Grid.[[R]]ow="0"  Content="Left Top"/>
         <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
+
         <GridSplitter Grid.Column="0" Grid.[[R]]ow="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
         <Button Grid.Column="0" Grid.Row="2"  Content="Left Bottom"/>
+
         <Button Grid.Column="0" Grid.[[R]]ow="2"  Content="Left Bottom"/>
         <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+
         <GridSplitter Grid.Column="1" Width="5" Grid.[[R]]owSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
         <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="Content"/>
+
         <Button Grid.Column="2" Grid.[[R]]ow="0" Grid.[[R]]owSpan="3"  Content="Content"/>
 
     </Grid>
 
     </Grid>
 
  </DockPanel>
 
  </DockPanel>
31行目: 31行目:
 
*TreeView を配置し、スプリットバー移動や、ツリーの展開で動的にスクロールバーが表示されるようにする
 
*TreeView を配置し、スプリットバー移動や、ツリーの展開で動的にスクロールバーが表示されるようにする
 
  <DockPanel>
 
  <DockPanel>
     <Button Content="Menu" DockPanel.Dock="Top"/>
+
     <Button Content="[[Menu]]" DockPanel.Dock="Top"/>
 
     <Button Content="Status" DockPanel.Dock="Bottom"/>
 
     <Button Content="Status" DockPanel.Dock="Bottom"/>
 
     <Grid ShowGridLines="True">
 
     <Grid ShowGridLines="True">
39行目: 39行目:
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
         </Grid.ColumnDefinitions>
 
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
+
         <Grid.[[R]]owDefinitions>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
             <RowDefinition Height="Auto"/>
+
             <[[R]]owDefinition Height="Auto"/>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
         </Grid.RowDefinitions>
+
         </Grid.[[R]]owDefinitions>
 
         <TreeView Grid.Column="0" ItemsSource="{Binding TreeItems}">
 
         <TreeView Grid.Column="0" ItemsSource="{Binding TreeItems}">
 
             <TreeView.ItemTemplate>
 
             <TreeView.ItemTemplate>
51行目: 51行目:
 
             </TreeView.ItemTemplate>
 
             </TreeView.ItemTemplate>
 
         </TreeView>
 
         </TreeView>
         <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
+
         <GridSplitter Grid.Column="0" Grid.[[R]]ow="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
         <Button Grid.Column="0" Grid.Row="2"  Content="Left Bottom"/>
+
         <Button Grid.Column="0" Grid.[[R]]ow="2"  Content="Left Bottom"/>
         <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+
         <GridSplitter Grid.Column="1" Width="5" Grid.[[R]]owSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
         <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="{Binding Name}"/>
+
         <Button Grid.Column="2" Grid.[[R]]ow="0" Grid.[[R]]owSpan="3"  Content="{Binding Name}"/>
 
     </Grid>
 
     </Grid>
 
  </DockPanel>
 
  </DockPanel>
63行目: 63行目:
 
*コンテンツとしてテキストを可変サイズにする
 
*コンテンツとしてテキストを可変サイズにする
 
  <DockPanel>
 
  <DockPanel>
     <Button Content="Menu" DockPanel.Dock="Top"/>
+
     <Button Content="[[Menu]]" DockPanel.Dock="Top"/>
 
     <Button Content="Status" DockPanel.Dock="Bottom"/>
 
     <Button Content="Status" DockPanel.Dock="Bottom"/>
 
     <Grid ShowGridLines="False">
 
     <Grid ShowGridLines="False">
71行目: 71行目:
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
         </Grid.ColumnDefinitions>
 
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
+
         <Grid.[[R]]owDefinitions>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
             <RowDefinition Height="Auto"/>
+
             <[[R]]owDefinition Height="Auto"/>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
         </Grid.RowDefinitions>
+
         </Grid.[[R]]owDefinitions>
         <Grid Grid.Column="0" Grid.Row="0" ShowGridLines="False">
+
         <Grid Grid.Column="0" Grid.[[R]]ow="0" ShowGridLines="False">
             <Grid.RowDefinitions>
+
             <Grid.[[R]]owDefinitions>
                 <RowDefinition Height="Auto"/>
+
                 <[[R]]owDefinition Height="Auto"/>
                 <RowDefinition Height="*"/>
+
                 <[[R]]owDefinition Height="*"/>
             </Grid.RowDefinitions>
+
             </Grid.[[R]]owDefinitions>
             <DockPanel Grid.Row="0">
+
             <DockPanel Grid.[[R]]ow="0">
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                 <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
+
                 <Button Content="Control" Width="Auto" DockPanel.Dock="[[R]]ight"/>
 
                 <TextBox />
 
                 <TextBox />
 
             </DockPanel>
 
             </DockPanel>
             <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
+
             <TreeView Grid.[[R]]ow="1" ItemsSource="{Binding TreeItems}">
 
                 <TreeView.ItemTemplate>
 
                 <TreeView.ItemTemplate>
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
94行目: 94行目:
 
             </TreeView>
 
             </TreeView>
 
         </Grid>
 
         </Grid>
         <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
+
         <GridSplitter Grid.Column="0" Grid.[[R]]ow="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
         <Grid Grid.Column="0" Grid.Row="2" ShowGridLines="False">
+
         <Grid Grid.Column="0" Grid.[[R]]ow="2" ShowGridLines="False">
             <Grid.RowDefinitions>
+
             <Grid.[[R]]owDefinitions>
                 <RowDefinition Height="Auto"/>
+
                 <[[R]]owDefinition Height="Auto"/>
                 <RowDefinition Height="*"/>
+
                 <[[R]]owDefinition Height="*"/>
             </Grid.RowDefinitions>
+
             </Grid.[[R]]owDefinitions>
             <DockPanel Grid.Row="0">
+
             <DockPanel Grid.[[R]]ow="0">
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                 <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
+
                 <Button Content="Control" Width="Auto" DockPanel.Dock="[[R]]ight"/>
 
                 <TextBox />
 
                 <TextBox />
 
             </DockPanel>
 
             </DockPanel>
             <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
+
             <TreeView Grid.[[R]]ow="1" ItemsSource="{Binding TreeItems}">
 
                 <TreeView.ItemTemplate>
 
                 <TreeView.ItemTemplate>
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
113行目: 113行目:
 
             </TreeView>
 
             </TreeView>
 
         </Grid>
 
         </Grid>
         <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+
         <GridSplitter Grid.Column="1" Width="5" Grid.[[R]]owSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
         <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="{Binding Name}"/>
+
         <Button Grid.Column="2" Grid.[[R]]ow="0" Grid.[[R]]owSpan="3"  Content="{Binding Name}"/>
 
     </Grid>
 
     </Grid>
 
  </DockPanel>
 
  </DockPanel>
121行目: 121行目:
 
[[File:1455_wpf_layout04.jpg]]
 
[[File:1455_wpf_layout04.jpg]]
 
  <DockPanel>
 
  <DockPanel>
     <Menu DockPanel.Dock="Top" Height="Auto">
+
     <[[Menu]] DockPanel.Dock="Top" Height="Auto">
         <MenuItem Header="ファイル(_F)" />
+
         <MenuItem [[Header]]="ファイル(_F)" />
         <MenuItem Header="編集(_E)" />
+
         <MenuItem [[Header]]="編集(_E)" />
         <MenuItem Header="オプション(_O)">
+
         <MenuItem [[Header]]="オプション(_O)">
             <MenuItem IsCheckable="True" Header="オプション1" />
+
             <MenuItem IsCheckable="True" [[Header]]="オプション1" />
             <MenuItem IsCheckable="True" Header="オプション2" />
+
             <MenuItem IsCheckable="True" [[Header]]="オプション2" />
             <MenuItem IsCheckable="True" Header="オプション3" />
+
             <MenuItem IsCheckable="True" [[Header]]="オプション3" />
         </MenuItem>
+
         </[[Menu]]Item>
     </Menu>
+
     </[[Menu]]>
 
     <StatusBar DockPanel.Dock="Bottom">
 
     <StatusBar DockPanel.Dock="Bottom">
         <StatusBarItem Width="60" DockPanel.Dock="Right">Panel2</StatusBarItem>
+
         <StatusBarItem Width="60" DockPanel.Dock="[[R]]ight">Panel2</StatusBarItem>
         <Separator DockPanel.Dock="Right" />
+
         <Separator DockPanel.Dock="[[R]]ight" />
         <StatusBarItem Width="60" DockPanel.Dock="Right">Panel3</StatusBarItem>
+
         <StatusBarItem Width="60" DockPanel.Dock="[[R]]ight">Panel3</StatusBarItem>
         <Separator DockPanel.Dock="Right" />
+
         <Separator DockPanel.Dock="[[R]]ight" />
 
         <StatusBarItem>Panel1</StatusBarItem>
 
         <StatusBarItem>Panel1</StatusBarItem>
 
     </StatusBar>
 
     </StatusBar>
143行目: 143行目:
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
             <ColumnDefinition MinWidth="100" Width="2*"/>
 
         </Grid.ColumnDefinitions>
 
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
+
         <Grid.[[R]]owDefinitions>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
             <RowDefinition Height="Auto"/>
+
             <[[R]]owDefinition Height="Auto"/>
             <RowDefinition MinHeight="100" Height="1*"/>
+
             <[[R]]owDefinition MinHeight="100" Height="1*"/>
         </Grid.RowDefinitions>
+
         </Grid.[[R]]owDefinitions>
         <Grid Grid.Column="0" Grid.Row="0" ShowGridLines="False">
+
         <Grid Grid.Column="0" Grid.[[R]]ow="0" ShowGridLines="False">
             <Grid.RowDefinitions>
+
             <Grid.[[R]]owDefinitions>
                 <RowDefinition Height="Auto"/>
+
                 <[[R]]owDefinition Height="Auto"/>
                 <RowDefinition Height="*"/>
+
                 <[[R]]owDefinition Height="*"/>
             </Grid.RowDefinitions>
+
             </Grid.[[R]]owDefinitions>
             <DockPanel Grid.Row="0">
+
             <DockPanel Grid.[[R]]ow="0">
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                 <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
+
                 <Button Content="Control" Width="Auto" DockPanel.Dock="[[R]]ight"/>
 
                 <TextBox />
 
                 <TextBox />
 
             </DockPanel>
 
             </DockPanel>
             <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
+
             <TreeView Grid.[[R]]ow="1" ItemsSource="{Binding TreeItems}">
 
                 <TreeView.ItemTemplate>
 
                 <TreeView.ItemTemplate>
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
166行目: 166行目:
 
             </TreeView>
 
             </TreeView>
 
         </Grid>
 
         </Grid>
         <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
+
         <GridSplitter Grid.Column="0" Grid.[[R]]ow="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
         <Grid Grid.Column="0" Grid.Row="2" ShowGridLines="False">
+
         <Grid Grid.Column="0" Grid.[[R]]ow="2" ShowGridLines="False">
             <Grid.RowDefinitions>
+
             <Grid.[[R]]owDefinitions>
                 <RowDefinition Height="Auto"/>
+
                 <[[R]]owDefinition Height="Auto"/>
                 <RowDefinition Height="*"/>
+
                 <[[R]]owDefinition Height="*"/>
             </Grid.RowDefinitions>
+
             </Grid.[[R]]owDefinitions>
             <DockPanel Grid.Row="0">
+
             <DockPanel Grid.[[R]]ow="0">
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
 
                 <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                 <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
+
                 <Button Content="Control" Width="Auto" DockPanel.Dock="[[R]]ight"/>
 
                 <TextBox />
 
                 <TextBox />
 
             </DockPanel>
 
             </DockPanel>
             <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
+
             <TreeView Grid.[[R]]ow="1" ItemsSource="{Binding TreeItems}">
 
                 <TreeView.ItemTemplate>
 
                 <TreeView.ItemTemplate>
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
 
                     <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
185行目: 185行目:
 
             </TreeView>
 
             </TreeView>
 
         </Grid>
 
         </Grid>
         <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+
         <GridSplitter Grid.Column="1" Width="5" Grid.[[R]]owSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
         <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="{Binding Name}"/>
+
         <Button Grid.Column="2" Grid.[[R]]ow="0" Grid.[[R]]owSpan="3"  Content="{Binding Name}"/>
 
     </Grid>
 
     </Grid>
 
  </DockPanel>
 
  </DockPanel>

2020年2月16日 (日) 04:34時点における最新版

WPF レイアウト サンプル

WPF | WPF レイアウト |

Explorer風

1452 wpf layout01.jpg

  • GridSplitterでサイズ変更可(行、列)
  • ShowGridLines="True" でグリッドレイアウトの分割を可視化
<DockPanel>
    <Button Content="Menu" DockPanel.Dock="Top"/>
    <Button Content="Status" DockPanel.Dock="Bottom"/>
    <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="100" Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition MinWidth="100" Width="2*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="100" Height="1*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition MinHeight="100" Height="1*"/>
        </Grid.RowDefinitions>
        <Button Grid.Column="0" Grid.Row="0"  Content="Left Top"/>
        <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
        <Button Grid.Column="0" Grid.Row="2"  Content="Left Bottom"/>
        <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
        <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="Content"/>
    </Grid>
</DockPanel>

ツリービューを配置

1453 wpf layout02.jpg

  • TreeView を配置し、スプリットバー移動や、ツリーの展開で動的にスクロールバーが表示されるようにする
<DockPanel>
    <Button Content="Menu" DockPanel.Dock="Top"/>
    <Button Content="Status" DockPanel.Dock="Bottom"/>
    <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="100" Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition MinWidth="100" Width="2*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="100" Height="1*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition MinHeight="100" Height="1*"/>
        </Grid.RowDefinitions>
        <TreeView Grid.Column="0" ItemsSource="{Binding TreeItems}">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
                    <TextBlock Text="{Binding Name}" />
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
        <Button Grid.Column="0" Grid.Row="2"  Content="Left Bottom"/>
        <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
        <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="{Binding Name}"/>
    </Grid>
</DockPanel>

ツリービューに対するコントロールボックスを追加

1454 wpf layout03.jpg

  • DocPanel により、ラベルとボタンをそれぞれ、左、右寄せ
  • コンテンツとしてテキストを可変サイズにする
<DockPanel>
    <Button Content="Menu" DockPanel.Dock="Top"/>
    <Button Content="Status" DockPanel.Dock="Bottom"/>
    <Grid ShowGridLines="False">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="100" Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition MinWidth="100" Width="2*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="100" Height="1*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition MinHeight="100" Height="1*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Column="0" Grid.Row="0" ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <DockPanel Grid.Row="0">
                <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
                <TextBox />
            </DockPanel>
            <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
                        <TextBlock Text="{Binding Name}" />
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>
        </Grid>
        <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
        <Grid Grid.Column="0" Grid.Row="2" ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <DockPanel Grid.Row="0">
                <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
                <TextBox />
            </DockPanel>
            <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
                        <TextBlock Text="{Binding Name}" />
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>
        </Grid>
        <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
        <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="{Binding Name}"/>
    </Grid>
</DockPanel>

メニューとステータスバー追加

1455 wpf layout04.jpg

<DockPanel>
    <Menu DockPanel.Dock="Top" Height="Auto">
        <MenuItem Header="ファイル(_F)" />
        <MenuItem Header="編集(_E)" />
        <MenuItem Header="オプション(_O)">
            <MenuItem IsCheckable="True" Header="オプション1" />
            <MenuItem IsCheckable="True" Header="オプション2" />
            <MenuItem IsCheckable="True" Header="オプション3" />
        </MenuItem>
    </Menu>
    <StatusBar DockPanel.Dock="Bottom">
        <StatusBarItem Width="60" DockPanel.Dock="Right">Panel2</StatusBarItem>
        <Separator DockPanel.Dock="Right" />
        <StatusBarItem Width="60" DockPanel.Dock="Right">Panel3</StatusBarItem>
        <Separator DockPanel.Dock="Right" />
        <StatusBarItem>Panel1</StatusBarItem>
    </StatusBar>
    <Grid ShowGridLines="False">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="100" Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition MinWidth="100" Width="2*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="100" Height="1*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition MinHeight="100" Height="1*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Column="0" Grid.Row="0" ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <DockPanel Grid.Row="0">
                <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
                <TextBox />
            </DockPanel>
            <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
                        <TextBlock Text="{Binding Name}" />
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>
        </Grid>
        <GridSplitter Grid.Column="0" Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
        <Grid Grid.Column="0" Grid.Row="2" ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <DockPanel Grid.Row="0">
                <TextBlock Text="Search" Width="Auto" DockPanel.Dock="Left"/>
                <Button Content="Control" Width="Auto" DockPanel.Dock="Right"/>
                <TextBox />
            </DockPanel>
            <TreeView Grid.Row="1" ItemsSource="{Binding TreeItems}">
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate DataType="{x:Type local:TreeEntity}" ItemsSource="{Binding Children}">
                        <TextBlock Text="{Binding Name}" />
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>
        </Grid>
        <GridSplitter Grid.Column="1" Width="5" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
        <Button Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"  Content="{Binding Name}"/>
    </Grid>
</DockPanel>