Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 476
loris91 Avatar asked Apr 20 '13 23:04

loris91


1 Answers

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.)

like image 115
aniski Avatar answered Nov 07 '22 02:11

aniski