天天看點

WP7 學習之pivot控件應用

Pivot控件用來過濾大量的資料集,在不同的視圖中檢視它們,或者針對同一個資料切換不同的視圖。Pivot控件跟Tab控件很像,但它是專門為Windows Phone和觸控界面設計的。它通過視圖間的橫向互相切換,這樣就可以讓使用者 用内置的觸控功能來回導航。

在Windows Phone内置的功能中,E-Mail和Calendar功能就是Pivot的一個應用。

<controls:Pivot Title="my test">

<controls:PivotItem Header="周一計劃">

<ListBox FontSize="30">

<ListBoxItem Content="oooooooooooo"></ListBoxItem>

<ListBoxItem Content="nnnnnnnnnnnn"></ListBoxItem>

<ListBoxItem Content="eeeeeeeeeeee"></ListBoxItem>

</ListBox>

</controls:PivotItem>

<controls:PivotItem Header="周二計劃">

<ListBox FontSize="30" >

<ListBoxItem Content="tttttttttttt"></ListBoxItem>

<ListBoxItem Content="wwwwwwwwwwww"></ListBoxItem>

<ListBoxItem Content="oooooooooooo"></ListBoxItem>

</ListBox>

</controls:PivotItem>

<controls:PivotItem Header="周三計劃">

<ListBox FontSize="30">

<ListBoxItem Content="hhhhhhhhhh"></ListBoxItem>

<ListBoxItem Content="rrrrrrrrrr"></ListBoxItem>

<ListBoxItem Content="eeeeeeeeeee"></ListBoxItem>

</ListBox>

</controls:PivotItem>

</controls:Pivot>

考慮到性能,盡量降低PivotItem的個數。

盡量實時加載裡面的内容,而不是在程式開始的時候就全部加載。

盡量用Pivot控件顯示相同類型的元素或者資料。

不要用Pivot控件實作類似導航工具的功能。

不要使用Application Bar提供導航。如果用Pivot是為了導航效果,那就相當于濫用了。

wp7