WP8 屏幕方向(滚动方法)
来源:互联网 发布:智能建站软件 编辑:程序博客网 时间:2024/04/27 19:46
Windows Phone 支持纵向和横向屏幕方向。
横向又分为: 向左横向 和 向右横向。
应用的默认方向为纵向 ,要指定应用支持纵向和横向,您必须在 XAML 或代码中将 SupportedOrientations 属性设置为PortraitOrLandscape。
可以使用不同的方法,以纵向或横向方向显示内容。其中两种方法是滚动和网格布局。
滚动方法:
滚动方法使用放置在 ScrollViewer 控件内的StackPanel 控件。如果要显示列表中的内容或者如果您在页面上拥有一个接着一个显示的不同控件,请使用此方法。StackPanel 允许您在应用中一个接一个地对子元素进行排序,且当您从纵向切换到横向时,如果屏幕上容纳不下 UI 元素,ScrollViewer 控件允许您滚动浏览StackPanel。
要使用滚动方法,通常您会执行以下步骤。
将页面的 SupportedOrientations 属性更改为PortraitOrLandscape。
将“内容面板”区域中的默认 Grid 替换为ScrollViewer 和StackPanel。
下面的示例演示一个 StackPanel 和ScrollViewer 中的多个控件。
<ScrollViewer VerticalScrollBarVisibility="Auto"><!--You must apply a background to the StackPanel control or you
will be unable to pan the contents.-->
<StackPanel Background="Transparent" >
<!--Adding various controls and UI elements.-->
<Button Content="This is a Button" />
<Rectangle Width="100" Height="100" Margin="12,0"
HorizontalAlignment="Left" Fill="Red"/>
<Rectangle Width="100" Height="100" HorizontalAlignment="Center"
Fill="Red"/>
<Rectangle Width="100" Height="100" Margin="12,0"
HorizontalAlignment="Right" Fill="Red"/>
<TextBlock Text="This is a line of text that will wrap in portrait
orientation but not landscape orientation." TextWrapping="Wrap" />
<CheckBox Content="A CheckBox"/>
<RadioButton Content="A RadioButton" />
</StackPanel>
</ScrollViewer>
这是纵向效果:
当我们点击横向按钮时,如下图:
- WP8 屏幕方向(滚动方法)
- WP8 屏幕方向(网格布局)
- wp (1) 屏幕滚动方法
- 滚动方向
- ubuntu鼠标滚轮方向修改方法(运动方向和滚轮滚动方向一致)
- WP8常用方法
- WP8页面跳转方法
- ios 设置屏幕方向的两种方法
- ios 设置屏幕方向的两种方法
- ios 设置屏幕方向的两种方法
- Activity设置全屏的两种方法,固定屏幕方向
- Swift用CoreMotion得到屏幕当前方向的方法
- iOS 设置屏幕方向的两种方法
- ios 设置屏幕方向的两种方法
- 滚动屏幕
- 屏幕滚动
- H5 中监听页面滚动事件,判断滚动方向的方法
- UIScrollView判断滚动方向
- Windows系统中访问控制概述
- 青城之恋
- JavaScript
- 博弈论入门小结
- 2011阿里巴巴集团实习生招聘笔试题 C&C++
- WP8 屏幕方向(滚动方法)
- error C3872: '0x3000': this character is not allowed in an identifier 解决方法
- 蒙哥马利快速幂摸算法
- 设置应用内的系统控件语言
- Android实现推送方式解决方案
- 程序员2013新年计划
- Hadoop集群(第5期)_Hadoop安装配置
- WCF服务端运行时架构体系详解
- Linux 文件系统剖析