简体   繁体   中英

Tablet WPF Windows Desktop Application - Scrolling issue

I'm running my desktop application WPF on tablet ASUS ME400 Intel Atom Z2760. All working properly, but when I use scrollviewer, scroll movement with finger (abilitate panning mode horizontalOnly) at the end of scroll with finger, the window moves and you see the taskbar for a moment. The effect is not seen if I scroll with my finger, did not arrive until founded in the scrollbar.

How i can avoid this window movement? How I can lock my windows and do not permit to move when I scroll at the end of scrollbar?

In the ScrollViewer object, where you've enabled the panning, register a new event for ManipulationBoundaryFeedback .

<ScrollViewer PanningMode="Both" ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback">
    <!-- your content is here... -->
</ScrollViewer>

In the codebehind, you have to handle the event, by setting the Handled property to true :

void ScrollViewer_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
{
    e.Handled = true;
}

(By setting the Handled property to true , we are actually telling that the event has got handled by us, so we are stopping the message's bubbling process in the Visual Tree, before it would reach the Window / Application - whichever would cause the shaking.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM