ScrollViewer scrollViewer = new ScrollViewer();
// 构造函数
public MainPage()
{
InitializeComponent();
for (int x = ; x <= ; x++)
{
listBox1.Items.Add(x);
}
} private double actuableOffset, validStartOffset;
private bool mplStarted;
protected override void OnManipulationStarted(ManipulationStartedEventArgs e)
{
base.OnManipulationStarted(e);
mplStarted = true;
} protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
{
//150是下拉的距离可以自己调适
if (actuableOffset > && scrollViewer.VerticalOffset == )
{
MessageBox.Show("Head pull bingo!");
}
if (actuableOffset < - && scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
{
MessageBox.Show("Tail pull bingo!");
}
base.OnManipulationCompleted(e);
} protected override void OnMouseMove(MouseEventArgs e)
{
//head capture startRelative
if (scrollViewer.VerticalOffset == )
{
if (mplStarted)
{
mplStarted = false;
validStartOffset = e.GetPosition(null).Y;
}
actuableOffset = e.GetPosition(null).Y - validStartOffset;
}
//tail
if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
{
if (mplStarted)
{
mplStarted = false;
validStartOffset = e.GetPosition(null).Y;
}
actuableOffset = e.GetPosition(null).Y - validStartOffset;
}
//UIControlHelper.FindFirst<Pivot>().Title = actuableOffset;
base.OnMouseMove(e);
}
05-11 10:49