zoukankan      html  css  js  c++  java
  • Windows UWP开发系列 – RelativePanel

    RelativePanel是在Windows 10 UWP程序中引入的一种新的布局面板,它是通过附加属性设置元素间的位置关系来对实现布局的。一个简单的示例如下:

    <RelativePanel>
        <TextBox x:Name="textBox1" Text="textbox" Margin="5"/>
        <Button x:Name="blueButton" Margin="5" Background="LightBlue" Content="ButtonRight" RelativePanel.RightOf="textBox1"/>
        <Button x:Name="orangeButton" Margin="5" Background="Orange" Content="ButtonBelow" RelativePanel.RightOf="textBox1" RelativePanel.Below="blueButton"/>
    </RelativePanel>

    布局的效果如下:

            

    它支持如下几种位置关系:

    和其它元素相邻:

    • LeftOf
    • RightOf
    • Above
    • Below

    和其他元素边缘对齐:

    • AlignBottomWith
    • AlignLeftWith
    • AlignTopWith
    • AlignRightWith

    和其它元素中心对齐:

    • AlignHorizontalCenterWith
    • AlignVerticalCenterWith

    和Panel边缘对齐:

    • AlignBottomWithPanel
    • AlignLeftWithPanel
    • AlignRightWithPanel
    • AlignTopWithPanel

    和Panel中心对齐:

    • AlignHorizontalCenterWithPanel
    • AlignVerticalCenterWithPanel

    试用了一下,常用的对齐方式都有了,基本上各种复杂的布局都能轻易的实现。唯一的缺点是,这种布局方式和和其它元素耦合的,里面的元素不像其它的面板那样可以随意删除。不过也非常强大了,比起之前WinRt下的那些布局面板要方便多了。

  • 相关阅读:
    安装MySQL5.7.19 网上的文章参考 并做了部分修改
    从hadoop一路配置到spark
    java面试问题收集(2)
    JAVA的 IO NIO AIO笔记
    Shiro
    Spring注解使用注意点
    oracle RAC
    spark随笔
    Storm知识点笔记
    真机调试手机程序,电脑插上手机数据线虚拟机中的系统就死掉
  • 原文地址:https://www.cnblogs.com/TianFang/p/4886246.html
Copyright © 2011-2022 走看看