windows phone8.1列表顯示

來源:互聯網
上載者:User

標籤:windows phone   手機   控制項   

     在windows phone8.1中,列表顯示資料分為以下幾個控制項,ItemsControl,ListBox,ListView,GridView,SemanticZoom控制項。

以前我一直在用ListBox控制項或者ListView控制項來顯示簡單資料,今天自己隨便玩玩,寫了一些簡單的只顯示的資料,用ItemsControl實現,開始覺得還好,當我把資料量增大一下時候,坑爹的情況發生了,竟然不能滑動!!!也就是只能顯示手機頁面那多高的資料,不能滑動來查看後面那些資料,完全沒有ListBox控制項或者ListView控制項用著爽,於是在網上看了看。

     原來,ItemsControl只實現一個列表的最準系統,沒有實現一些比較複雜的邏輯功能,例如資料量很大時,可以產生滑動效果,列表選擇被選中效果。所以,不能滑動。正是因為它的功能如此簡潔,它比其他幾個清單控制項執行速度高。

    下來看看如何?ItemsControl 資料的滑動功能。

     

 <Grid>                <ItemsControl x:Name="item">            <!--這裡設定控制項實現滑動功能-->            <ItemsControl.Template>                <ControlTemplate TargetType="ItemsControl">                    <ScrollViewer>                        <ItemsPresenter/>                    </ScrollViewer>                </ControlTemplate>            </ItemsControl.Template>            <!--設定資料範本-->            <ItemsControl.ItemTemplate>                <DataTemplate>                    <StackPanel Orientation="Horizontal">                        <TextBlock Text="{Binding Name}" FontSize="23">                        </TextBlock>                        <TextBlock Text="{Binding Num}" FontSize="23"/>                    </StackPanel>                </DataTemplate>            </ItemsControl.ItemTemplate>        </ItemsControl>    </Grid>

     是不是很好實現,這裡只是前台簡單的代碼,如果查看Demo檔案,請點擊進行下載http://pan.baidu.com/s/1sFcVc

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

windows phone8.1列表顯示

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.