locked
PointerMoved not firing on Canvas inside ScrollViewer

    Question

  • I have a Canvas inside a ScrollViewer. The PointerPressed event fires fine but the PointerMoved only seems to fire if I touch the screen for a few seconds (enough for a Holding event to fire) and won't continue to fire. I've tried using Canvas.CapturePointer(e.Pointer) but that doesn't seem to have any effect. I have a ToggleButton that I want to use to determine whether the ScrollViewer acts normal or if the Canvas gets locked in place and takes the inputs from the pointer. How do I make it so that the PointerMoving even will fire on the Canvas?
    Friday, December 19, 2014 9:20 PM

Answers

All replies

  • The ScrollViewer has taken over the pointer handling. If you want the pointer events on the Canvas you'll need to block the ScrollViewer from entering its gesture handling mode. I discuss this in more detail in my blog entry Where did all my gestures go?   

    --Rob

    Friday, December 19, 2014 9:54 PM
    Owner
  • Rob,

    I am having some trouble getting this to work. There is a specific time that I want to pass the gesture and I basically control that by a ToggleButton. So I would check the state of the ToggleButton instead of using InDisableScrollViewerRegion. I have a Canvas inside of a ScrollView. Since I am using a ScrollView I disable scrolling the normal way:

    ScrollView.VerticalScrollMode = ScrollMode.Disabled;
    ScrollView.HorizontalScrollMode = ScrollMode.Disabled;

    Would your OnPointerPressed code be for the Canvas or ScrollView? Fyi, my goal is to be able to draw on the canvas using the stylus when the ToggleButton is unchecked and using touch when it is checked. It's currently working fine with the stylus.

    Also, I have a lot going on in PointerMoved and PointerReleased. Does this require anything different?

    Thanks,

    nol_b

    (aka nol__b when I'm at work)



    • Edited by nol__b Thursday, January 08, 2015 1:05 AM
    Thursday, January 08, 2015 12:51 AM