【发布时间】:2012-01-08 04:13:06
【问题描述】:
我正在设计一个带有枢轴控制的阅读应用程序。当来自第一页时,我想禁用右滑事件,以便用户只需向左滑即可进入下一页。从最后一页来时,我想禁用左滑事件。
Silverlight Toolkit 中有一个 lockablePivot 控件,但该控件将禁用所有轻弹事件。谁能给我一些建议。
【问题讨论】:
标签: windows-phone-7 pivot windows-phone-7.1
我正在设计一个带有枢轴控制的阅读应用程序。当来自第一页时,我想禁用右滑事件,以便用户只需向左滑即可进入下一页。从最后一页来时,我想禁用左滑事件。
Silverlight Toolkit 中有一个 lockablePivot 控件,但该控件将禁用所有轻弹事件。谁能给我一些建议。
【问题讨论】:
标签: windows-phone-7 pivot windows-phone-7.1
您看过 microsoft silverlight 工具包中的 LockablePivot 控件吗?
http://www.windowsphonegeek.com/articles/Windows-Phone-Toolkit-LockablePivot-in-depth
【讨论】:
我认为您应该在这里重新考虑您的设计决定。 Metro 设计语言说明了枢轴的工作方式以及人们对此的习惯。更改此设置会使人们的用户体验变得更糟,因为他们希望您能够在枢轴上轻弹。
【讨论】:
像这样使用 PivotItem 违反了 UI 指南,因此不应该真正实施。但是,出于理论考虑,如果不出意外,您可以这样做。
为您的第一个和最后一个 PivotItem 命名。
<controls:PivotItem Header="Item1" Name="first">
...
<controls:PivotItem Header="Item5" Name="last">
处理 Pivot 的 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;
}
【讨论】: