このようなPivotItemを使用すると、UIガイドに反するので、実際に実装するべきではありません。しかし、理論のために何もしなければ、このようなことをすることができます。
最初と最後のPivotItemに名前を付けます。
<controls:PivotItem Header="Item1" Name="first">
...
<controls:PivotItem Header="Item5" Name="last">
ピボットのLoadingPivotItem
とLoadedPivotItem
イベントを処理します。
//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;
}
あなたの助言のためのThans。実際にピボットを書き換えているので、ピボットコントロールのようには見えません。 – ellic