码迷,mamicode.com
首页 > Windows程序 > 详细

windows 10 RelativePanel

时间:2015-06-10 11:58:21      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

The new RelativePanel implements a style of layout that is defined by the relationships between its child elements. It‘s intended for use in creating app layouts that can adapt to changes in screen resolution. TheRelativePanel eases the process of rearranging elements by defining relationships between elements, which allows you to build more dynamic UI without using nested layouts.

In the following example, blueButton will appear to the right of textBox1 regardless of changes in orientation or layout, and orangeButton will appear immediately below, and aligned with, blueButton—even as the width of textBox1 changes as text is typed into it. It would previously have required rows and columns in aGrid to achieve this effect, but now it can be done using far less markup.

技术分享

 
<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>

 

windows 10 RelativePanel

标签:

原文地址:http://www.cnblogs.com/gisbeginner/p/4565495.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!