[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

[涉及某信息预发布的版本可能在它的商业版本大幅修改。对于这里提供的信息,微软不作任何担保。]

在MSDN中,Windows 10 SDK 的东东上,都会声明这一句话,我也引过来吧啦,他不担保,我也保不了。

RelativePanel

RelativePanel是Win10的 Xaml 中新的一个控件,看名字就知道是一个相对布局的控件。问了一个安卓的同学,说这个东西和他们的RelativeLayout是一样子的,都是相对于其它的东西布局的。

一、示例

<StackPanel>
<RelativePanel>
<Rectangle x:Name="rectangle1" Fill="Red" Height="100" Width="100" />
<Rectangle Fill="Blue" Height="50" Width="50" RelativePanel.RightOf="rectangle1" RelativePanel.Below="rectangle1"/>
</RelativePanel>
<RelativePanel>
<Rectangle x:Name="rectangle2" Fill="Red" Height="100" Width="100" />
<Rectangle x:Name="rectangle3" Fill="Blue" Height="50" Width="50" RelativePanel.RightOf="rectangle2" RelativePanel.AlignBottomWith="rectangle2"/>
<Rectangle x:Name="rectangle4" Fill="Yellow" Height="100" Width="100" RelativePanel.RightOf="rectangle2"/>
<Rectangle Fill="Blue" Height="50" Width="50" RelativePanel.RightOf="rectangle2" RelativePanel.AlignBottomWith="rectangle2"/>
</RelativePanel>
</StackPanel>

二、主要属性

RelativePanel的用法与 Canvas 是相似的,都是用附件属性来设置。用法很简单,在这里例一下属性吧。

主要分以面四类

1.相对于控件的位置

RelativePanel.Above
RelativePanel.Below
RelativePanel.LeftOf
RelativePanel.RightOf

2.对齐于控件

RelativePanel.AlignTopWith
RelativePanel.AlignBottomWith
RelativePanel.AlignLeftWith
RelativePanel.AlignRightWith
RelativePanel.AlignHorizontalCenterWith
RelativePanel.AlignVerticalCenterWith

3.对齐于Panel,这个是bool 值

RelativePanel.AlignTopWithPanel
RelativePanel.AlignBottomWithPanel
RelativePanel.AlignLeftWithPanel
RelativePanel.AlignRightWithPanel
RelativePanel.AlignHorizontalCenterWithPanel
RelativePanel.AlignVerticalCenterWithPanel

三、总结

这个布局控件真心应该会很广泛的,方便了布局方式,也使布局更加的灵活了。但对于自己适应空间的大小,可能会差一些,到真正应用的时候就知道啦。

PS: 之前写了一次,浏览器莫名的刷新,全没啦,今天又很是的忙,也觉得这个控件也没写多少写的,就这么草草的结束的。

本文地址:http://www.cnblogs.com/gaoshang212/p/4539273.html

【Win10】UAP/UWP/通用 开发之 RelativePanel的更多相关文章

  1. 【Win10】UAP/UWP/通用 开发之 x:Bind

    [Some information relates to pre-released product which may be substantially modified before it's co ...

  2. 【Win10】UAP/UWP/通用 开发之 x:DeferLoadStrategy

    [Some information relates to pre-released product which may be substantially modified before it's co ...

  3. 【Win10】UAP/UWP/通用 开发之 SplitView

    [Some information relates to pre-released product which may be substantially modified before it's co ...

  4. 【Win10】UAP/UWP (通用程序) 开发初体验(1) 之 开发准备

    一.准备: 1.准备一个 10074或更高版本的Win10.可以通过 https://insider.windows.com/ 地址,加入Windows 的会员俱乐部免费获取的. 2.下载Visual ...

  5. UWP开发之Template10实践二:拍照功能你合理使用了吗?(TempState临时目录问题)

    最近在忙Asp.Net MVC开发一直没空更新UWP这块,不过有时间的话还是需要将自己的经验和大家分享下,以求共同进步. 在上章[UWP开发之Template10实践:本地文件与照相机文件操作的MVV ...

  6. UWP开发之Template10实践:本地文件与照相机文件操作的MVVM实例(图文付原代码)

    前面[UWP开发之Mvvmlight实践五:SuspensionManager中断挂起以及复原处理]章节已经提到过Template10,为了认识MvvmLight的区别特做了此实例. 原代码地址:ht ...

  7. UWP开发之Mvvmlight实践七:如何查找设备(Mobile模拟器、实体手机、PC)中应用的Log等文件

    在开发中或者后期测试乃至最后交付使用的时候,如果应用出问题了我们一般的做法就是查看Log文件.上章也提到了查看Log文件,这章重点讲解下如何查看Log文件?如何找到我们需要的Packages安装包目录 ...

  8. Liferay7 BPM门户开发之10: 通用流程实现从Servlet到Portlet(Part1)

    开发目的: 实现通用流程自动化处理(即实现不需要hardcode代码的bpm统一处理后台,仅需要写少量前端html form代码和拖拽设计BPM定义) 既可独立运行或可依托于Liferay或依托其它门 ...

  9. Android开发之旅: Intents和Intent Filters(理论部分)

    引言 大部分移动设备平台上的应用程序都运行在他们自己的沙盒中.他们彼此之间互相隔离,并且严格限制应用程序与硬件和原始组件之间的交互. 我们知道交流是多么的重要,作为一个孤岛没有交流的东西,一定毫无意义 ...

随机推荐

  1. (转)ant 使用指南

    ant 使用指南  文件转载自:http://www.cnblogs.com/hoojo/archive/2013/06/14/java_ant_project_target_task_run.htm ...

  2. 解决jquery-ui-autocomplete选择列表被Bootstrap模态窗遮挡的问题

    最近在一个ASP.NET MVC5项目中使用Bootstrap的模态窗(弹出层)来让用户填写内容,其中的一个编辑框提供了自动完成功能,用jQuery UI Autocomplete来实现. 因为我是W ...

  3. varnish

    html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...

  4. Loadrunner监控Linux的17个指标

    这17个指标根据需要设置吧,指标设置的越多,对服务器真实值影响越大,所以要秉承按需而设的原则.   1.Average load:Average number of processes simulta ...

  5. Ubuntu Server安装R和Rstudio(zz)

    Ubuntu Server安装R和Rstudio 发表于 技术天堂 2014-03-15 21:03 字数: 534 阅读量: 205 R是一个在科研领域很常用的工具,经常用R的年轻人或者经常上统计之 ...

  6. win7环境下安装运行gotour【转载整理】

    转载请注明出处:http://www.cnblogs.com/Vulpers/p/5562586.html 最近尝试学习golang,在某个网站(真忘了)上发现gotour是一款灰常叼的教程& ...

  7. flex中下拉框的实现

    flex中下拉框的实现 <mx:ComboBox id = "combobox" dataProvider = "{deviceCodeType }" e ...

  8. 日志——JSON的相关方法

    http://www.cnblogs.com/henryxu/archive/2013/03/10/2952738.html JSON  jar包: commons-lang.jar commons- ...

  9. python3中返回字典的键

    我在看<父与子的编程之旅>的时候,有段代码是随机画100个矩形,矩形的大小,线条的粗细,颜色都是随机的,代码如下, import pygame,sys,random from pygame ...

  10. styleId妙用

    styleId妙用: <html:text property="etpsBlocReg.cptlTotal" style="width: 94%;" re ...