日期:2014-05-16  浏览次数:20891 次

重新想象 Windows 8 Store Apps (11)

[源码下载]


重新想象 Windows 8 Store Apps (11) - 控件之 ListView 和 GridView



作者:webabcd


介绍
重新想象 Windows 8 Store Apps 之?ListView 和 GridView

  • ListView - 列表控件
  • GridView - 网格控件



示例
1、ListView 的 Demo
ListViewDemo.xaml

<Page
    x:Class="XamlDemo.Controls.ListViewDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:XamlDemo.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <DataTemplate x:Key="ItemTemplate">
            <StackPanel Orientation="Vertical">
                <TextBlock TextWrapping="Wrap" FontSize="14.667" Text="{Binding Name}" HorizontalAlignment="Left" />
                <TextBlock TextWrapping="Wrap" FontSize="14.667" Text="{Binding Age}" HorizontalAlignment="Left"/>
            </StackPanel>
        </DataTemplate>
        <Style x:Key="ItemContainerStyle"  TargetType="ListViewItem">
            <Setter