开发者

Multi-touch gestures on Silverlight 4 and Windows Phone 7

开发者 https://www.devze.com 2023-02-19 08:13 出处:网络
Question:What is the best cross platform multitouch approach for Silverlight? Background: I’ve been developing large SL4 applications and have now started porting them to WP7.

Question: What is the best cross platform multitouch approach for Silverlight?

Background:

I’ve been developing large SL4 applications and have now started porting them to WP7.

The porting itself has been fantastic – virtually no changes required between the platforms. But now with WP7 comes the issue of multi-touch. With growing bemusement, I discovered that there are now at least 4 different options for implementing multi-touch in Silverlight, none ideal, and none perfectly cross platform.

The best analysis of the Microsoft provided options I’ve found are from Jeff Prosise (parts 1, 2, 3, and 4) and Charles Petzold.

Great! GestureService/GestureListener in the Silverlight Toolkit looks perfect. Just what I need. So I start down the path of incorporating this in my app and run into the following frustrating sequence.

  • GestureService/GestureListener is only in the WP7 Silverlight Toolkit, but not in the Silverlight Toolkit for SL4.

  • OK. Download the source for the WP7 Toolkit and attempt to make my own version of

    GestureService/GestureListener for SL4. Even though Touch.FrameReported is available in SL4, another key class Microsoft.Xna.Framework.Input.Touch is not available. Dead End.

  • Start looking for open source alternative touch libraries. Waste many hours.

  • Settle on www.codeplex.com/multitouch. Discover after many more wasted hours that only Portrait mode is currently supported, and not Landscape. Dead End.

So, is there any workaround to get GestureService/GestureListener working in SL4? If not, can an开发者_如何学Pythonyone guess when/if it will be available in the SL4 toolkit? Waiting for SL5 isn't really an option.


There is no out of the box solution. However, we have built and open source touch library to provide parity and wire in the missing events on the Silverlight side. Take a look:

http://lighttouch.codeplex.com/


I had the same issue a year ago. Unfortunately, I had to implement my own solution for SL which was based on Touch.FrameReported and TouchFrameEventArgs.GetTouchPoints. I know, it is a little bit low-level, but it was the only reliable option for me.

Here is a short tutorial by Tim Heuer: http://timheuer.com/blog/archive/2009/07/30/silverlight-3-multi-touch-introduction-fundamentals-basics.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消