首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > windows >

(最新)Windows 八 Metro 应用开发的入门 Metro App的几个新控件

2012-12-26 
(最新)Windows 8 Metro 应用开发的入门 Metro App的几个新控件c)、选定项事件当选定项改变时触发事件Select

(最新)Windows 8 Metro 应用开发的入门 Metro App的几个新控件

c)、选定项事件

当选定项改变时触发事件SelectionChanged,与Listview、DropDownlist等控件的效果差不多,在事件处理程序中可以做相应处理,如下:

(最新)Windows 八 Metro 应用开发的入门 Metro App的几个新控件

Flipview控件来源于ItemsControl,它的使用比较简单,类似于一个容器,只需要往里塞视图即可,至于如何处理上下页的翻转,内部都已经完全实现好了,不仅可以往里面旋转图片,还可以放置其他的视图。如下:

它的使用非常的简单:

(最新)Windows 八 Metro 应用开发的入门 Metro App的几个新控件

注意看视图ZoomedInView的右下角有个红圈围起来的一个“一”字按钮,点它可以切换到远景视图,当点击远景视图中的一个项时又切换回近景视图。这通常在快速预览数据列表时很有用,可以向用户隐藏一些不必要的数据。

SemanticZoom有两个非常重要的属性ZoomedInView和ZoomedOutView,当向这两个视图提供布局时该控件才可进行近远景视图的切换。如下:

XAML:

<VariableSizedWrapGrid Grid.Row="1" MaximumRowsOrColumns="5" ItemHeight="44" ItemWidth="44" HorizontalAlignment="Left" Height="262" Margin="10,10,0,0" VerticalAlignment="Top" Width="396">            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="Red"/>            <Rectangle Fill="Blue"/>            <Rectangle Fill="White" Height="80" VariableSizedWrapGrid.RowSpan="2"/>            <Rectangle Fill="Green" Width="80" VariableSizedWrapGrid.ColumnSpan="2"/>        </VariableSizedWrapGrid>

VariableSizedWrapGrid有几个非常重要的属性:

double ItemHeight 设置每个子项的高

double ItemWidth 设置每个子项的宽

Orientation Orientation 子元素的排列方向

int MaximumRowsOrColumns获取或设置影响换行点同时说明 Orientation 的值。

DependencyProperty RowSpanProperty 子元素占据的行数,如上图中的白色块。

DependencyProperty ColumnSpanProperty 子元素占据的列数,如上图中的绿色块。

小 结

这一章简单介绍了5个控件的常用方法,其实有过Silverlight/WPF经验的都很容易理解,也参考MSDN的相关文档。

热点排行