[Update] Windows Phone implements a pull-down refresh effect similar to "Weibo"

Source: Internet
Author: User

There are still a lot of bugs in the above text, and the implementation is muddy. Recently we have a good look at the scrollview api. below is the refined code, which is much less and accurate.

You only need to write the following code in the corresponding event.

The first status (you can update the blog Park news in the drop-down list ):

Status 2 (prompt that the drop-down range is enough to release and enter the update operation)

 

Status 3 (the system prompts that the update is in progress and returns to the first status after the update is complete)

 

 

 

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 is the drop-down distance and can be adjusted by yourself
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 <rule> (). Title = actuableOffset;
Base. OnMouseMove (e );
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.