简体   繁体   中英

Windows Phone 8.1 ManipulationDelta Event

I'm really confused about this Topic. None of the tutorials I found to eg move objects around when there's touch input works. For example they all do something like this:

Control.AddHandler(UIElement.ManipulationStartedEvent, new EventHandler
    <ManipulationStartedEventArgs>(Control_ManipulationStarted), true);

But there's no ManipulationStartedEventArgs, VS2013 can't find it and there's no way to add a using directive. Are those tutorials old and did MS change the way the ManipulationDelta works?

Adding it with the EventHandler section of the Properties section again doesn't work, no Event is fired no matter what I'm trying to do.

For manipulation to work the UI Element must have ManipulationMode property set to something other than None or System to be a manipulation event source; ie Set ManipulationMode to TranslateX if you want an event to fire on a horizontal pointer movement.

For UI manipulation in Windows Universal you have 3 events:

Each with their own EventArgs under System.Windows.Input namespace

The problem may however be the type of UI Element that you are using, not all accept/generate manipulation events.

Examples of UI Elements that don't:

  • WebView
  • (I expect Canvas but not sure, haven't tested)

Examples of UI Elements that do:

  • Textblock
  • ListView

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