T字形布局(厂字型布局)
1、
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="TopPane" toolkit:DockPanel.Dock="Top" Background="LightGreen" Height="100" MinHeight="20">
<Button Width="75" Height="23" Content="页头固定高度"/>
</Grid>
<Grid Name="LeftPane" toolkit:DockPanel.Dock="Left" Background="LightBlue" Width="265" MinWidth="40">
<Button Width="150" Height="23" Content="左侧固定宽度,高度自动适应"/>
</Grid>
<Grid Name="RightPane" Background="LightSeaGreen" toolkit:DockPanel.Dock="Right">
<Button Width="130" Height="23" Content="右侧宽度、高度自动适应"/>
</Grid>
</toolkit:DockPanel>
</Grid>
截图如下:
2、
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="TopPane" toolkit:DockPanel.Dock="Top" Background="LightGreen" Height="100" MinHeight="20">
<Button Width="75" Height="23" Content="高度固定"/>
</Grid>
<Grid Name="LeftPane" toolkit:DockPanel.Dock="Left" Background="LightBlue" Width="265" MinWidth="40">
<toolkit:DockPanel>
<Grid toolkit:DockPanel.Dock="Top" Height="70" Background="LightGray">
<Button Width="150" Height="23" Content="高度、宽度固定"/>
</Grid>
<Grid Background="LightPink">
<Button Width="150" Height="23" Content="高度自适应、宽度固定"/>
</Grid>
</toolkit:DockPanel>
</Grid>
<Grid Name="RightPane" Background="LightSeaGreen" toolkit:DockPanel.Dock="Right">
<Button Width="150" Height="23" Content="高度、宽度自适应"/>
</Grid>
</toolkit:DockPanel>
</Grid>
截图如下:
同字型布局:
1、
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="TopPane" toolkit:DockPanel.Dock="Top" Background="LightBlue" Height="100" MinHeight="20">
<Button Width="75" Height="23" Content="页头固定高度"/>
</Grid>
<Grid Name="TopMenu" toolkit:DockPanel.Dock="Top" Background="LightPink" Height="25" MinHeight="20">
<Button Width="75" Height="23" Content="导航栏"/>
</Grid>
<Grid Name="LeftPane" toolkit:DockPanel.Dock="Left" Background="LightCoral" Width="150" MinWidth="40">
<Button Width="75" Height="23" Content="宽度固定"/>
</Grid>
<Grid Name="RightPane" toolkit:DockPanel.Dock="Right" Width="150" Background="LightCyan">
<Button Width="75" Height="23" Content="宽度固定"/>
</Grid>
<Grid Name="MainTopPane" toolkit:DockPanel.Dock="Top" Background="LightGoldenrodYellow" Height="80" MinHeight="20">
<Button Width="75" Height="23" Content="高度固定"/>
</Grid>
<Grid Name="MainBottomPane" toolkit:DockPanel.Dock="Bottom" Background="LightGray" Height="70">
<Button Width="75" Height="23" Content="高度固定"/>
</Grid>
<Grid Name="MainMiddlePane" Background="LightGreen">
<Button Width="75" Height="23" Content="自适应"/>
</Grid>
</toolkit:DockPanel>
</Grid>
截图如下:
2、
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="TopPane" toolkit:DockPanel.Dock="Top" Background="LightBlue" Height="100" MinHeight="20">
<Button Width="75" Height="23" Content="页头固定高度"/>
</Grid>
<Grid Name="TopMenu" toolkit:DockPanel.Dock="Top" Background="LightPink" Height="25" MinHeight="20">
<Button Width="75" Height="23" Content="导航栏"/>
</Grid>
<Grid Name="LeftPane" toolkit:DockPanel.Dock="Left" Background="LightCoral" Width="150" MinWidth="40">
<Button Width="75" Height="23" Content="宽度固定"/>
</Grid>
<Grid Name="RightPane" toolkit:DockPanel.Dock="Right" Width="150" Background="LightCyan">
<Button Width="75" Height="23" Content="宽度固定"/>
</Grid>
<Grid Name="MainMiddlePane" Background="LightGreen">
<Button Width="75" Height="23" Content="自适应"/>
</Grid>
</toolkit:DockPanel>
</Grid>
截图如下:
川字结构(口字型):
<Grid x:Name="LayoutRoot" Background="White">
<toolkit:DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid Name="TopPane" toolkit:DockPanel.Dock="Top" Background="LightBlue" Height="30" MinHeight="20">
<Button Width="75" Height="23" Content="页头固定高度"/>
</Grid>
<Grid Name="BottomPane" toolkit:DockPanel.Dock="Bottom" Background="LightBlue" Height="30" MinHeight="20">
<Button Width="75" Height="23" Content="页尾固定高度"/>
</Grid>
<Grid Name="LeftPane" toolkit:DockPanel.Dock="Left" Background="LightCoral" Width="250" MinWidth="40">
<Button Width="75" Height="23" Content="宽度固定"/>
</Grid>
<Grid Name="RightPane" toolkit:DockPanel.Dock="Right" Width="250" Background="LightCyan">
<Button Width="75" Height="23" Content="宽度固定"/>
</Grid>
<Grid Name="MainMiddlePane" Background="LightGreen">
<Button Width="75" Height="23" Content="自适应"/>
</Grid>
</toolkit:DockPanel>
</Grid>
截图如下: