Windows10开发手记-RelativePanel使用详解
Windows 10已于7月29号面向全球发布,同时Universal Windows Platform(UWP) SDK也已正式放出,配合VS 2015我们可以开发出通用的Windows App。
在Windows 10 SDK中,新增和改变了很多特性,其中用于适配的新控件RelativePanel将会成为我们开发中最常用的Windows 10组件。

布局示例
代码示例:
<RelativePanel BorderBrush="Gray" BorderThickness="10">
<Rectangle x:Name="RedRect" Fill="Red" MinHeight="100" MinWidth="100"/>
<Rectangle x:Name="BlueRect" Fill="Blue" MinHeight="100" MinWidth="100"
RelativePanel.RightOf="RedRect" />
<!-- Width is not set on the green and yellow rectangles.
It's determined by the RelativePanel properties. -->
<Rectangle x:Name="GreenRect" Fill="Green" MinHeight="100" Margin="0,5,0,0"
RelativePanel.Below="RedRect"
RelativePanel.AlignLeftWith="RedRect"
RelativePanel.AlignRightWith="BlueRect"/>
<Rectangle Fill="Yellow" MinHeight="100"
RelativePanel.Below="GreenRect"
RelativePanel.AlignLeftWith="BlueRect"
RelativePanel.AlignRightWithPanel="True"/>
</RelativePanel>
特性详解:
开发中我们主要使用RelativePanel作为容器,使用RelativePanel的附加属性对其内容进行布局,例如RightOf、Above等,用法与Grid的附加属性类似。同时这些附加属性与iOS中新特性AutoLayout的约束很像,下面是对其附加属性详细解释。
| 用法 | 描述 |
|---|---|
|
RelativePanel.Above |
设置当前element为目标element的上方 |
|
RelativePanel.AlignBottomWith |
设置当前element与目标element底部对齐 |
|
RelativePanel.AlignBottomWithPanel |
设置当前element与RelativePanel底部对齐 |
|
RelativePanel.AlignHorizontalCenterWith |
设置当前element与目标element水平中心对齐 |
|
RelativePanel.AlignHorizontalCenterWithPanel |
设置当前element与RelativePanel水平中心对齐 |
|
RelativePanel.AlignLeftWith |
设置当前element与目标element左边框对齐 |
|
RelativePanel.AlignLeftWithPanel |
设置当前element与RelativePanel左边框对齐 |
|
RelativePanel.AlignRightWith |
设置当前element与目标element右边框对齐 |
|
RelativePanel.AlignRightWithPanel |
设置当前element与RelativePanel右边框对齐 |
|
RelativePanel.AlignTopWith |
设置当前element与目标element顶部对齐 |
|
RelativePanel.AlignTopWithPanel |
设置当前element与RelativePanel顶部对齐 |
|
RelativePanel.AlignVerticalCenterWith |
设置当前element与目标element垂直中心对齐 |
|
RelativePanel.AlignVerticalCenterWithPanel |
设置当前element与RelativePanel垂直中心对齐 |
|
RelativePanel.Below |
设置当前element为目标element的下方 |
|
RelativePanel.LeftOf |
设置当前element为目标element的左边 |
|
RelativePanel.RightOf |
设置当前element为目标element的右边 |
总结
RelativePanel能够实现几乎所有针对布局的约束,能够满足各种布局需求,配合VisualStateTrigger能够较完美的视线响应式的UI,满足Windows 10设想的小至IoT设备大至80寸Hub的应用情景。
Windows10开发手记-RelativePanel使用详解的更多相关文章
- iPhone应用开发 UITableView学习点滴详解
iPhone应用开发 UITableView学习点滴详解是本文要介绍的内容,内容不多,主要是以代码实现UITableView的学习点滴,我们来看内容. -.建立 UITableView DataTab ...
- Java开发利器Myeclipse全面详解
Java开发利器Myeclipse全面详解: Ctrl+1:修改代码错误 Alt+Shift+S:Source命令 Ctrl+7:单行注释 Ctrl+Shift+/ :多行注释 Ctrl+I :缩进( ...
- iOS 开发之照片框架详解(2)
一. 概况 本文接着 iOS 开发之照片框架详解,侧重介绍在前文中简单介绍过的 PhotoKit 及其与 ALAssetLibrary 的差异,以及如何基于 PhotoKit 与 AlAssetLib ...
- VirtualBox开发环境的搭建详解(转)
VirtualBox开发环境的搭建详解 有关VirtualBox的介绍请参考:VirtualBox_百度百科 由于VirtualBox官网提供的搭建方法不够详细,而且本人在它指导下,从下载所需的开 ...
- IE8"开发人员工具"使用详解下(浏览器模式、文本模式、JavaScript调试、探查器)
来源: http://www.cnblogs.com/JustinYoung/archive/2009/04/03/kaifarenyuangongju2.html 在上一篇文章IE8“开发人员工具” ...
- IE8“开发人员工具”使用详解上(各级菜单详解)
来源: http://www.cnblogs.com/JustinYoung/archive/2009/03/24/kaifarenyuangongju.html IE8“开发人员工具”使用详解上(各 ...
- iOS 开发之照片框架详解之二 —— PhotoKit 详解(下)
本文链接:http://kayosite.com/ios-development-and-detail-of-photo-framework-part-three.html 这里接着前文<iOS ...
- iOS 开发之照片框架详解
转载自:http://kayosite.com/ios-development-and-detail-of-photo-framework.html 一. 概要 在 iOS 设备中,照片和视频是相当重 ...
- iOS 开发之照片框架详解之二 —— PhotoKit 详解(上)
转载自:http://kayosite.com/ios-development-and-detail-of-photo-framework-part-two.html 一. 概况 本文接着 iOS 开 ...
随机推荐
- html 中使用 iconfont、fontAwesome
在HTML中尽量使用iconfont 替代图片有很多好处,而且方便,可以设置大小.颜色 等 可以用于字体的设置. 一.使用iconfont 1.打开iconfont 官网 iconfont.cn. 2 ...
- 4、订单详情 /items/order/detail?orderNo=201903251750380001
<template> <div class="write"> <div class="adr"> <div class ...
- MySql中对Group by后的结果数进行Count
今天在写MySQ的SQL语句的时候遇到了一个奇怪的问题 select count(*) from subsitealbum t1, photo t2,files t3 where t1.SourceA ...
- sed (未完,待续)
sed [options] 'command' file(s) options: -e<script>或--expression=<script>:以选项中的指定的script ...
- 289. Game of Life数组生存游戏
[抄题]: According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a ...
- 一、Windows许可证即将过期怎么办
当Win10系统提示“windows许可证即将过期”窗口时,直接点击“转到‘设置’”按钮,此时将显示“Windows激活”界面,从此界面中可以获取当前Win10版本信息. 由于Win10激活即将过期, ...
- mvc输出json时报HTTP Status 406错误
1.mvc输出json时报HTTP Status 406错误 错误纠结了2天时间,今天总与整对了,少jackson-databind引用 对于Spring 4.1.x 和以上, jackson-dat ...
- ef core中使用code first
这个配置还是挺坑,照这个一步步做倒是可以 https://www.cnblogs.com/chenzhaoyu/p/7831980.html
- 2019.02.17 spoj Query on a tree VI(链分治)
传送门 题意简述:给你一棵nnn个黑白点的树,支持改一个点的颜色,询问跟某个点颜色相同的连通块大小. 思路: 还是链分治 233 记fi,0/1f_{i,0/1}fi,0/1表示iii的所有颜色为0 ...
- ABP框架系列之三十七:(Navigation-导航)
Every web application has some menu to navigate between pages/screens. ASP.NET Boilerplate provides ...