• Windows Phone 8.1 新特性


    本篇我们来介绍Windows Phone 8.1 新特性中的列表选择控件。
    在Windows Phone 8 时代,大家都会使用 LongListSelector 来实现列表选择控件,对数据进行分组显示。比如通讯录中,按照名字首字母进行分组,点击分组标题后跳转到该标题对应的分组。
    而Windows Phone 8.1 中会利用 ListView 和 SemanticZoom 来实现,下面我们来看看实现过程。
    首先我们来认识一下ListView 和 SemanticZoom:
    ListView 从字面上并不难理解,一个列表视图控件,而它实际的作用也和字面表现的差不多,它是一个在一个列表中滚动显示项目的集合控件。
    SemanticZoom 可能看起来有些陌生,语义缩放。它是允许用户在集合项目的两个视图之间缩放的一个容器控件。简单来说,当我们对一个联系人集合进行了按首字母分组后,我们可以通过语义缩放控件完成联系人列表和字母列表两种视图的缩放,通过选择字母来导航到该字母分组。
     
    可能用到的源码片段:http://code.662p.com/list/14_1.html
    下面我们来看看代码实现,首先是XAML:
    <SemanticZoom x:Name="semanticZoom" IsZoomOutButtonEnabled="True" CanChangeViews="True">
        <SemanticZoom.ZoomedInView>
            <ListView x:Name="listViewDetail" IsSwipeEnabled="True" IsTapEnabled="True" IsItemClickEnabled="True" IsZoomedInView="True">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid Height="40">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Background="AliceBlue" Grid.Column="0"/>
                            <TextBlock Grid.Column="1" Text="{Binding ContactName}" FontSize="30"/>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <Border Background="Blue" Height="50" Width="50" HorizontalAlignment="Left" Margin="0,20,0,20" Tapped="Border_Tapped">
                                    <TextBlock Text="{Binding Title}" FontSize="30"/>
                                </Border>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <VariableSizedWrapGrid Orientation="Vertical" Margin="0 0 0 20" ItemHeight="75"/>
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </ListView.GroupStyle>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
        </SemanticZoom.ZoomedInView>
        <SemanticZoom.ZoomedOutView>
            <ListView x:Name="listViewSummary" Background="Black" IsZoomedInView="False">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Border Height="70" Width="400" Background="Blue" Margin="10,10,10,10">
                            <TextBlock Text="{Binding Group.Title}" FontSize="30"/>
                        </Border>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
        </SemanticZoom.ZoomedOutView>
    </SemanticZoom>
    

      详细说明:http://wp.662p.com/thread-8197-1-1.html

  • 相关阅读:
    【hdu6035】 Colorful Tree dfs序
    【GDOI2018模拟8】 数学竞赛 三角函数性质+记忆化搜索
    【BZOJ4184】shallot 线性基
    失分统计#1
    【learning】微信跳一跳辅助c++详解 轻松上万 【下】
    【2018北京集训十二】 coin 矩阵快速幂
    【learning】微信跳一跳辅助c++详解 轻松上万 【上】
    【2018北京集训6】Lcm DFT&FWT
    【BZOJ3143】【HNOI2013】游走 高斯消元
    【bzoj1855】 [Scoi2010]股票交易 单调队列优化DP
  • 原文地址:https://www.cnblogs.com/huasili/p/4120180.html
Copyright © 2020-2023  润新知