微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

silverlight学习之路之页面布局

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>


截图如下:

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐