簡體   English   中英

停止在Windows Phone 8中循環執行樞軸控制

[英]Stop looping pivot control in windows phone 8

我想停止從第一個項目到最后一個項目以及相反的項目的循環。

這是我在xaml中所做的更改:

 <phone:Pivot x:Name="pivot" Height="698" VerticalAlignment="Bottom" Margin="0,0,0,10" 
LoadingPivotItem="Pivot_LoadingPivotItem" LoadedPivotItem="Pivot_LoadedPivotItem" >

C#:

PivotItem currentItem;
private void Pivot_LoadingPivotItem(object sender, PivotItemEventArgs e)
{
    if (currentItem == firstItem && e.Item == lastItem) 
    {
        e.Item.Header = currentItem.Header;
        pivot.SelectedItem = currentItem;
    }

    if (currentItem == lastItem && e.Item == firstItem) 
    {
        e.Item.Header = currentItem.Header;
        pivot.SelectedItem = currentItem;
    }

}

private void Pivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
{
    currentItem = e.Item;
}

它不起作用..

問題是該項目正在停留(如我想要的),但該項目的標題不是。

你知道為什么嗎? 解決辦法是什么?

非常感謝你 :)

您確實不應該在這種情況下使用數據透視表-這不是它創建的目的。 相反,您應該自己實現它,這是一個好的開始: 創建可滑動的ContentControl

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM