• Windows Phone 上拉刷新、下拉刷新


    ScrollViewer scrollViewer = new ScrollViewer();
    // 构造函数
    public MainPage()
    {
        InitializeComponent();
        for (int x = 0; x <= 30; 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 > 150 && scrollViewer.VerticalOffset == 0)
        {
            MessageBox.Show("Head pull bingo!");
        }
        if (actuableOffset < -150 && scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
        {
            MessageBox.Show("Tail pull bingo!");
        }
            base.OnManipulationCompleted(e);
    }
    
    protected override void OnMouseMove(MouseEventArgs e)
    {
        //head capture startRelative
        if (scrollViewer.VerticalOffset == 0)
        {
            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);
    }
  • 相关阅读:
    词义辨析:事件与事故
    术语-BPM:BPM
    职位:DBA
    职业-软件:软件测试工程师
    职位-软件工程师:软件工程师
    职业-IT:全栈工程师
    术语-技术栈:技术栈
    .NET Core:目录
    .NET Core:.Net Core 百科
    术语-抽象:抽象
  • 原文地址:https://www.cnblogs.com/lihaibo-Leao/p/3141663.html
Copyright © 2020-2023  润新知