2015-01-07 94 views
1

我想提出一個通用的應用程序。對於Windows Phone部分,我已經在其中實現了一個數據透視頁面。現在我希望禁用透視頁面中的輕掃手勢(用於導航不同透視項目),以便只有在輕按第一個透視項目上的按鈕時才顯示第二個透視項目。我試着將Pivot控件的IsHitTestVisible屬性設置爲false,但是所有的PivotItem都被阻塞了。禁用輕掃手勢中的Windows Phone 8.1轉動控制

回答

1

它違背了WINDOWS用戶界面指南,不應該真正實施。

然而,理論的緣故,如果沒有別的,你可以做這樣的事情。

考慮你有5個樞紐項目,給你的第一個和最後PivotItem作爲

<controls:PivotItem Header="Item1" Name="first"> 
... 

<controls:PivotItem Header="Item5" Name="last"> 

處理透視的LoadingPivotItemLoadedPivotItem事件的名稱。然後,您可以做這樣的事情:

//class level variable we use for the current pivot 
PivotItem currentItem = null; 

private void Pivot_LoadingPivotItem(object sender, PivotItemEventArgs e) 
{ 
//if the next item is going to be "first" pivot 
//and the previous item was the "last" pivot... 
if (e.Item == first && currentItem == last) 
{ 
    //...reset the Pivot back to the last one. 
    mainPivot.SelectedItem = last; 
} 

//same theory as above but checking if we're 
//sliding to the last one from the first one 
if (e.Item == last && currentItem == first) 
{ 
    mainPivot.SelectedItem = first; 
} 
} 

private void mainPivot_LoadedPivotItem(object sender, PivotItemEventArgs e) 
{ 
//once the pivot is loaded, update the currentItem 
currentItem = e.Item; 
} 

希望這個作品.. 如有任何疑問..回覆。